not enable compile time verification of checks for NULL. Instead of these
routines, use the macros from memory.h
- - eg to allocate a single object:
+ - eg to allocate a single object:
virDomainPtr domain;
if (VIR_ALLOC(domain) < 0) {
- __virRaiseError(VIR_ERROR_NO_MEMORY)
- return NULL;
+ virReportOOMError(NULL);
+ return NULL;
}
int ndomains = 10;
if (VIR_ALLOC_N(domains, ndomains) < 0) {
- __virRaiseError(VIR_ERROR_NO_MEMORY)
- return NULL;
+ virReportOOMError(NULL);
+ return NULL;
}
- eg to allocate an array of object pointers
int ndomains = 10;
if (VIR_ALLOC_N(domains, ndomains) < 0) {
- __virRaiseError(VIR_ERROR_NO_MEMORY)
- return NULL;
+ virReportOOMError(NULL);
+ return NULL;
}
- eg to re-allocate the array of domains to be longer
ndomains = 20
if (VIR_REALLOC_N(domains, ndomains) < 0) {
- __virRaiseError(VIR_ERROR_NO_MEMORY)
- return NULL;
+ virReportOOMError(NULL);
+ return NULL;
}
- eg to free the domain
if (virBufferError(&buf)) {
virBufferFreeAndReset(&buf);
- virReportOOMError(...);
+ virReportOOMError(NULL);
return NULL;
}
- if a recently commited patch breaks compilation on a platform
or for a given driver then it's fine to commit a minimal fix
directly without getting the review feedback first
- - similary if make check or make syntax-chek breaks, if there is
+ - similary if make check or make syntax-check breaks, if there is
an obvious fix, it's fine to commit immediately
The patch should still be sent to the list (or tell what the fix was if
trivial) and 'make check syntax-check' should pass too before commiting
virDomainPtr domain;
if (VIR_ALLOC(domain) < 0) {
- __virRaiseError(VIR_ERROR_NO_MEMORY)
- return NULL;
+ virReportOOMError(NULL);
+ return NULL;
}
</pre></li>
int ndomains = 10;
if (VIR_ALLOC_N(domains, ndomains) < 0) {
- __virRaiseError(VIR_ERROR_NO_MEMORY)
- return NULL;
+ virReportOOMError(NULL);
+ return NULL;
}
</pre></li>
int ndomains = 10;
if (VIR_ALLOC_N(domains, ndomains) < 0) {
- __virRaiseError(VIR_ERROR_NO_MEMORY)
- return NULL;
+ virReportOOMError(NULL);
+ return NULL;
}
</pre></li>
ndomains = 20
if (VIR_REALLOC_N(domains, ndomains) < 0) {
- __virRaiseError(VIR_ERROR_NO_MEMORY)
- return NULL;
+ virReportOOMError(NULL);
+ return NULL;
}
</pre></li>
if (virBufferError(&buf)) {
virBufferFreeAndReset(&buf);
- virReportOOMError(...);
+ virReportOOMError(NULL);
return NULL;
}
<li>if a recently commited patch breaks compilation on a platform
or for a given driver then it's fine to commit a minimal fix
directly without getting the review feedback first</li>
- <li>if make check or make syntax-chek breaks, if there is
+ <li>if make check or make syntax-check breaks, if there is
an obvious fix, it's fine to commit immediately.
The patch should still be sent to the list (or tell what the fix was if
trivial) and 'make check syntax-check' should pass too before commiting