mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-22 11:22:23 +00:00
docs: Refer to virReportOOMError in the HACKING file
Instead of refering to __virRaiseError(VIR_ERROR_NO_MEMORY).
This commit is contained in:
parent
a6b00cbb16
commit
b1cd474c77
22
HACKING
22
HACKING
@ -166,13 +166,13 @@ codebase, because they encourage a number of serious coding bugs and do
|
|||||||
not enable compile time verification of checks for NULL. Instead of these
|
not enable compile time verification of checks for NULL. Instead of these
|
||||||
routines, use the macros from memory.h
|
routines, use the macros from memory.h
|
||||||
|
|
||||||
- eg to allocate a single object:
|
- eg to allocate a single object:
|
||||||
|
|
||||||
virDomainPtr domain;
|
virDomainPtr domain;
|
||||||
|
|
||||||
if (VIR_ALLOC(domain) < 0) {
|
if (VIR_ALLOC(domain) < 0) {
|
||||||
__virRaiseError(VIR_ERROR_NO_MEMORY)
|
virReportOOMError(NULL);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -182,8 +182,8 @@ routines, use the macros from memory.h
|
|||||||
int ndomains = 10;
|
int ndomains = 10;
|
||||||
|
|
||||||
if (VIR_ALLOC_N(domains, ndomains) < 0) {
|
if (VIR_ALLOC_N(domains, ndomains) < 0) {
|
||||||
__virRaiseError(VIR_ERROR_NO_MEMORY)
|
virReportOOMError(NULL);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
- eg to allocate an array of object pointers
|
- eg to allocate an array of object pointers
|
||||||
@ -192,8 +192,8 @@ routines, use the macros from memory.h
|
|||||||
int ndomains = 10;
|
int ndomains = 10;
|
||||||
|
|
||||||
if (VIR_ALLOC_N(domains, ndomains) < 0) {
|
if (VIR_ALLOC_N(domains, ndomains) < 0) {
|
||||||
__virRaiseError(VIR_ERROR_NO_MEMORY)
|
virReportOOMError(NULL);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
- eg to re-allocate the array of domains to be longer
|
- eg to re-allocate the array of domains to be longer
|
||||||
@ -201,8 +201,8 @@ routines, use the macros from memory.h
|
|||||||
ndomains = 20
|
ndomains = 20
|
||||||
|
|
||||||
if (VIR_REALLOC_N(domains, ndomains) < 0) {
|
if (VIR_REALLOC_N(domains, ndomains) < 0) {
|
||||||
__virRaiseError(VIR_ERROR_NO_MEMORY)
|
virReportOOMError(NULL);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
- eg to free the domain
|
- eg to free the domain
|
||||||
@ -297,7 +297,7 @@ eg typical usage is as follows:
|
|||||||
|
|
||||||
if (virBufferError(&buf)) {
|
if (virBufferError(&buf)) {
|
||||||
virBufferFreeAndReset(&buf);
|
virBufferFreeAndReset(&buf);
|
||||||
virReportOOMError(...);
|
virReportOOMError(NULL);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -385,7 +385,7 @@ to build:
|
|||||||
- if a recently commited patch breaks compilation on a platform
|
- if a recently commited patch breaks compilation on a platform
|
||||||
or for a given driver then it's fine to commit a minimal fix
|
or for a given driver then it's fine to commit a minimal fix
|
||||||
directly without getting the review feedback first
|
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
|
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
|
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
|
trivial) and 'make check syntax-check' should pass too before commiting
|
||||||
|
@ -192,8 +192,8 @@
|
|||||||
virDomainPtr domain;
|
virDomainPtr domain;
|
||||||
|
|
||||||
if (VIR_ALLOC(domain) < 0) {
|
if (VIR_ALLOC(domain) < 0) {
|
||||||
__virRaiseError(VIR_ERROR_NO_MEMORY)
|
virReportOOMError(NULL);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
</pre></li>
|
</pre></li>
|
||||||
|
|
||||||
@ -204,8 +204,8 @@
|
|||||||
int ndomains = 10;
|
int ndomains = 10;
|
||||||
|
|
||||||
if (VIR_ALLOC_N(domains, ndomains) < 0) {
|
if (VIR_ALLOC_N(domains, ndomains) < 0) {
|
||||||
__virRaiseError(VIR_ERROR_NO_MEMORY)
|
virReportOOMError(NULL);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
</pre></li>
|
</pre></li>
|
||||||
|
|
||||||
@ -216,8 +216,8 @@
|
|||||||
int ndomains = 10;
|
int ndomains = 10;
|
||||||
|
|
||||||
if (VIR_ALLOC_N(domains, ndomains) < 0) {
|
if (VIR_ALLOC_N(domains, ndomains) < 0) {
|
||||||
__virRaiseError(VIR_ERROR_NO_MEMORY)
|
virReportOOMError(NULL);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
</pre></li>
|
</pre></li>
|
||||||
|
|
||||||
@ -227,8 +227,8 @@
|
|||||||
ndomains = 20
|
ndomains = 20
|
||||||
|
|
||||||
if (VIR_REALLOC_N(domains, ndomains) < 0) {
|
if (VIR_REALLOC_N(domains, ndomains) < 0) {
|
||||||
__virRaiseError(VIR_ERROR_NO_MEMORY)
|
virReportOOMError(NULL);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
</pre></li>
|
</pre></li>
|
||||||
|
|
||||||
@ -314,7 +314,7 @@
|
|||||||
|
|
||||||
if (virBufferError(&buf)) {
|
if (virBufferError(&buf)) {
|
||||||
virBufferFreeAndReset(&buf);
|
virBufferFreeAndReset(&buf);
|
||||||
virReportOOMError(...);
|
virReportOOMError(NULL);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -419,7 +419,7 @@
|
|||||||
<li>if a recently commited patch breaks compilation on a platform
|
<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
|
or for a given driver then it's fine to commit a minimal fix
|
||||||
directly without getting the review feedback first</li>
|
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.
|
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
|
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
|
trivial) and 'make check syntax-check' should pass too before commiting
|
||||||
|
Loading…
x
Reference in New Issue
Block a user