> > I'm adding something in to my mud which I've decided to store as a > > structure, similar to how extradescs are stored. Unlike extradescs, there > > are no strings, only numbers which are stored. As a result, when I > > rewrite the free_extra_descriptions, it gives me an error regarding > > integers, pointers, and casts for each line I attempt to free an integer. > > If I remove those, it no longer complains. It is my understandng from > > this that simply by freeing the structure itself, the integers are freed? > > If you only have numbers stored, id est, not strings, then you need not free > them individually, and it's enough just freeing the struct. The only time > you need to free things inside the struct is if you have strings stored in > them. > > Regards, > Torgny > And in addition to this, only those structs that have extra items that are stored in memory. For example, if you CREATE more than just one structure..... struct char_data { struct blah_data *blah; }; CREATE(ch, struct char_data, 1); CREATE(ch->blah, struct blah_data, 1); You would need to reverse the creation order and free blah first, then ch. free(ch->blah); free(ch); Hope this helps :) Mythran -- +---------------------------------------------------------------+ | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html | | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html | | Newbie List: http://groups.yahoo.com/group/circle-newbies/ | +---------------------------------------------------------------+
This archive was generated by hypermail 2b30 : 06/25/03 PDT