🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: gnu.g++.lib.bug
1 messages
1 total messages Started by Stephen Schaefer Thu, 11 Jan 1990 16:58
calloc/cfree
#558
Author: Stephen Schaefer
Date: Thu, 11 Jan 1990 16:58
35 lines
1628 bytes
In libg++ 1.36.2, ChangeLog top reading Wed Jan 3 08:29:43 1990 Doug
Lea, malloc.c defines calloc, but does not define cfree.  I understand
that cfree is superfluous, and may be replaced by free, but we're
linking some C++ code with some old C code.  The old C code calls
calloc and cfree, and when the loader doesn't find cfree in libg++.a,
it looks in libc.a.  There, cfree is defined in the same module with
calloc, and we get a multiply defined error for calloc.  The following
change to malloc.c prevents the problem:

RCS file: RCS/malloc.c,v, file: RCS/malloc.c,v
retrieving revision 1.1, file: RCS/malloc.c,v
diff -c -r1.1 malloc.c, file: RCS/malloc.c,v
*** /tmp/,RCSt1015847	Thu Jan 11 11:56:00 1990
--- malloc.c	Wed Jan 10 17:50:51 1990
***************
*** 961,966 ****
--- 961,973 ----
  };
  
  
+ /* cfree does nothing except free, but when old code uses it, it would
+    otherwise drag in a conflicting calloc definition from libc.a */
+ inline void cfree(void* mem)
+ {
+   free(mem);
+ }
+ 
  unsigned int malloc_usable_size(void* mem)
  {
    mchunkptr p = (mchunkptr)((char*)mem - SIZE_SZ); 

--
	Stephen P. Schaefer, Postmaster	MCNC
	sps@mcnc.org			P.O. Box 12889
	...!mcnc!sps			RTP, NC 27709
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads