OK, if you're going to do this:

if (x) {
   message
   exit
}

all over the place, why not do this instead:

void *xalloc(size_t amount, char *msg)
{
   void *ret = alloc(amount);
   if (! ret) {
     fprintf(stderr, "%s: Alloc of %d bytes failed\n", msg, amount);
     exit(1);
   }
}

same for realloc.

Why? because:
1. you're repeating the same code over and over
2. you're not telling people where you failed, or how much you tried to allocate
    this kind of fatal error should be informative

just a comment

ron

_______________________________________________
flashrom mailing list
[email protected]
http://www.flashrom.org/mailman/listinfo/flashrom

Reply via email to