Christian Theil Have wrote:

I think it looks good :-) I was working on some similar code based on a dict, which I was still testing out, but your patch is cleaner. I look forward to trying it out, but I wont have the opportunity to test it until Monday though.

About changing close and fclose everywhere in the codebase, you could get around this without having to change the rest the of codebase by using a few macros , eg.

#ifdef SunOS
#define close(fd) unlock_and_close(fd)


int unlock_and_close(fd) {
#ifdef close(fd)
#undef close(fd)
        printf("unlock_and_close do the stuff..\n");
    return close(fd);
#define close(fd) unlock_and_close(fd)

and similarly for fclose...


That would work. I wasn't sure if the Mbuni team would want to go that way, or the Kannel way:

#define close(x) you_should_not_call_close_directly(x)

I personally decided against the #define because I wanted to be able to check that all instances of close/fclose had been modified in the source I was working on. I did look at trying to figure out how to wrap the libc call, but I thought that might be a bit too destructive to my schedule. ;)

I'm still new to the gwlib code, I didn't realise it had a dict! Too bad it uses octstr's as keys.

Let me know if you run into any problems. If I find any, I'll let the list know.

Devel mailing list

Reply via email to