On 03/22/2013 07:44 AM, Michal Privoznik wrote: > Currently, our code is plenty of following scheme: > > if (VIR_ALLOC(dummyPtr) < 0) { > virReportOOMError(); > goto cleanup; > } > > or something similar. What if we just move the OOM reporting into > VIR_ALLOC? One thing you might want to consider is the case where the OOM is caused by some bug in the code, for example incorrectly computing the size of a buffer to allocate, or a loop that keeps allocating again and again until failure. Currently we might get some useful information in the form of the function and line number where the error occurred. With your change that information would be lost. Likely the times when this would be helpful would be extremely rare, but just in case, you might want to think about having the VIR_ALLOC* macros send __FILE__, __FUNCTION__, and __LINE__ to virAlloc* to be passed on to a new variation of virReportOOMError() that takes those as args rather than filling them out inline. -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list