On 1/24/07, Johannes Weiner <hannes@saeurebad.de> wrote:
There has to be a proper way handling out-of-memory. The lib can't do anything anymore without memory - am I right?
I like this memory handling scheme. It always bothered me that _all_ libraries do something of the sort, but hey, it's C. As for safe_mem, I don't think exiting is a good idea, as it may still be possible to output something at that point in the calling program. I would prefer something like: static void *safe_mem(void *r) { if(!r) { _alpm_log(PM_LOG_ERROR, "Memory exhausted.\n"); pm_errno = PM_ERR_MEMORY; alpm_release(); } return(r); } Meh, that doesn't seem right either... but I don't feel like a library should call exit().
_alpm_runscriptlet is really long and I'm going to split it.
Yeah, that one needs some help 8) Great ideas, thanks alot.