On Mon, 6 Jul 1998, Dean Takemori wrote: >#define CREATE(result, type, number) do {\ > if ((number <= 0) || \ > !((result) = (type *)calloc((number),sizeof(type))))\ > { perror("malloc failure"); abort(); } } while(0) Well, if you ask for 0 bytes, you should write 0 bytes to what you get. :) I'll forward it to the bug database in case Jeremy wants to add the check. >#define RECREATE(result,type,number) do {\ > if ((number < 0) || \ > !((result)=(type*)realloc((result),sizeof(type)*(number))))\ > { perror("realloc failure"); abort(); } } while(0) Calling realloc() with 0 size is the same as free(). -- George Greer, greerga@circlemud.org | Genius may have its limitations, but http://patches.van.ml.org/ | stupidity is not thus handicapped. http://www.van.ml.org/CircleMUD/ | -- Elbert Hubbard +------------------------------------------------------------+ | Ensure that you have read the CircleMUD Mailing List FAQ: | | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html | +------------------------------------------------------------+
This archive was generated by hypermail 2b30 : 12/15/00 PST