That spot of code is from save.c, I believe it can be found in both fread_char and fread_pet (but I could be wrong on the 2nd one, and I'm too lazy to go check :D) yes, clan_lookup does take a text argument in the form of <clan name> and return the integer value for its index in the clan_table... the problem w/ the default method of that call is that fread_string automatically str_dup's the output, allocating a chunk of memory to that string, which is used by clan_lookup to get the index, and then discarded, but not freed... I think you typoed fread_string at one point for free_string, and it took me a minute to figure out that it was a typo, but yes that's right... I think michael's way would be a little more efficient in that it designates a temp holder variable that is then used by clan_lookup and freed afterward, and a static variable would also probably be a nice thing for fread_string to use, but if you made that change you'd have to alter all of your fread_string calls to include str_dup(fread_string(fp)) where appropriate, or else I believe at the end of character loading, all strings that were assigned using fread_string would then hold the value that was returned in the very last call, being that they would all be pointing to that static location to pull their data from...
As for the previous post regarding certain things you'd like to see written in C that are available as options in D, I believe this sums it up: The whole basis for my posts were not to show how well everyone else can do things in C. It was about why C wasn't able to do enough for me. Maybe I'm really missing the point on why I needed to use LUA and look for other means to get things to work the way that I wanted. But I am always willing to try and learn new things and if you can show how these types of things and how they can be written like this in C, then maybe I should have just asked for examples along time ago and just did all the coding in C.. But I was thinking that was one of the main downfalls of C Based Muds. This is the right attitude to take about this venture of yours... as a person that's merely trying to determine how something might be accomplished in C that you know how to accomplish in another language, to see if it would be more or less efficient or time-worthy or whatever, you'd probably get a lot more... constructive criticism... than if it appears you're just coming in and saying how much C sucks for not being able to do this stuff, and how ROM coders need to switch to another language with features that most of them probably would never even bother rewriting in the first place :) Some people consider Perl to be an inferior language to C for one reason or another, but that doesn't mean it's better suited for the job in some cases... but really it's not about what C can do better than D or vice versa or how long you have to write something in either language to perform the job at hand, it's about which one is better suited for the job at hand, the 'job at hand' being the features and functionality someone may be trying to put into their mud, and not necessarily trying to optimize every single aspect of them, because mud's really don't eat up very many resources unless they're enormous, and optimizing can really be a pain in the ass to worry about needlessly :D Richard Lindsey -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Christopher Bunting Sent: Thursday, April 07, 2005 10:28 AM To: [email protected] Subject: Re: Memory issues. > > if ( !str_cmp(word,"Clan") ) > > { > > char name[MIL] = fread_string(fp); > > ch->clan = clan_lookup(name); > > fMatch = TRUE; > > break; > > } Hello, Wouldn't you be using MSL instead of MIL? And from that block of code, going by how I've written clan stuff before, it's not close to how i'd do it or how I've ever seen it done. Clan lookup would normally be an arg: Name would = argument ->clan = clan_lookup(argument); Then you free it with fread_string, Clan lookup by name is complete, now free it. ->clan = clan_lookup(fread_string(fp)); That is just off the top of my head because without knowing where you are calling that and how it's being used. I can't even begin to think where it would be or why it's written like that. Just my thoughts, Chris -- ROM mailing list [email protected] Unsubscribe here ->>> http://www.rom.org/cgi-bin/mailman/listinfo/rom

