mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-03 07:33:50 +00:00
Adapt to VIR_ALLOC and virAsprintf in docs/
This commit is contained in:
parent
dc6f2dadac
commit
9021488a5b
20
HACKING
20
HACKING
@ -528,10 +528,8 @@ routines, use the macros from viralloc.h.
|
||||
|
||||
virDomainPtr domain;
|
||||
|
||||
if (VIR_ALLOC(domain) < 0) {
|
||||
virReportOOMError();
|
||||
if (VIR_ALLOC(domain) < 0)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -540,10 +538,8 @@ routines, use the macros from viralloc.h.
|
||||
virDomainPtr domains;
|
||||
size_t ndomains = 10;
|
||||
|
||||
if (VIR_ALLOC_N(domains, ndomains) < 0) {
|
||||
virReportOOMError();
|
||||
if (VIR_ALLOC_N(domains, ndomains) < 0)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -552,10 +548,8 @@ routines, use the macros from viralloc.h.
|
||||
virDomainPtr *domains;
|
||||
size_t ndomains = 10;
|
||||
|
||||
if (VIR_ALLOC_N(domains, ndomains) < 0) {
|
||||
virReportOOMError();
|
||||
if (VIR_ALLOC_N(domains, ndomains) < 0)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -566,10 +560,8 @@ recommended only for smaller arrays):
|
||||
virDomainPtr domains;
|
||||
size_t ndomains = 0;
|
||||
|
||||
if (VIR_EXPAND_N(domains, ndomains, 1) < 0) {
|
||||
virReportOOMError();
|
||||
if (VIR_EXPAND_N(domains, ndomains, 1) < 0)
|
||||
return NULL;
|
||||
}
|
||||
domains[ndomains - 1] = domain;
|
||||
|
||||
|
||||
@ -581,10 +573,8 @@ scales better, but requires tracking allocation separately from usage)
|
||||
size_t ndomains = 0;
|
||||
size_t ndomains_max = 0;
|
||||
|
||||
if (VIR_RESIZE_N(domains, ndomains_max, ndomains, 1) < 0) {
|
||||
virReportOOMError();
|
||||
if (VIR_RESIZE_N(domains, ndomains_max, ndomains, 1) < 0)
|
||||
return NULL;
|
||||
}
|
||||
domains[ndomains++] = domain;
|
||||
|
||||
|
||||
|
@ -663,10 +663,8 @@
|
||||
<pre>
|
||||
virDomainPtr domain;
|
||||
|
||||
if (VIR_ALLOC(domain) < 0) {
|
||||
virReportOOMError();
|
||||
if (VIR_ALLOC(domain) < 0)
|
||||
return NULL;
|
||||
}
|
||||
</pre>
|
||||
</li>
|
||||
|
||||
@ -675,10 +673,8 @@
|
||||
virDomainPtr domains;
|
||||
size_t ndomains = 10;
|
||||
|
||||
if (VIR_ALLOC_N(domains, ndomains) < 0) {
|
||||
virReportOOMError();
|
||||
if (VIR_ALLOC_N(domains, ndomains) < 0)
|
||||
return NULL;
|
||||
}
|
||||
</pre>
|
||||
</li>
|
||||
|
||||
@ -687,10 +683,8 @@
|
||||
virDomainPtr *domains;
|
||||
size_t ndomains = 10;
|
||||
|
||||
if (VIR_ALLOC_N(domains, ndomains) < 0) {
|
||||
virReportOOMError();
|
||||
if (VIR_ALLOC_N(domains, ndomains) < 0)
|
||||
return NULL;
|
||||
}
|
||||
</pre>
|
||||
</li>
|
||||
|
||||
@ -702,10 +696,8 @@
|
||||
virDomainPtr domains;
|
||||
size_t ndomains = 0;
|
||||
|
||||
if (VIR_EXPAND_N(domains, ndomains, 1) < 0) {
|
||||
virReportOOMError();
|
||||
if (VIR_EXPAND_N(domains, ndomains, 1) < 0)
|
||||
return NULL;
|
||||
}
|
||||
domains[ndomains - 1] = domain;
|
||||
</pre></li>
|
||||
|
||||
@ -718,10 +710,8 @@
|
||||
size_t ndomains = 0;
|
||||
size_t ndomains_max = 0;
|
||||
|
||||
if (VIR_RESIZE_N(domains, ndomains_max, ndomains, 1) < 0) {
|
||||
virReportOOMError();
|
||||
if (VIR_RESIZE_N(domains, ndomains_max, ndomains, 1) < 0)
|
||||
return NULL;
|
||||
}
|
||||
domains[ndomains++] = domain;
|
||||
</pre>
|
||||
</li>
|
||||
|
Loading…
x
Reference in New Issue
Block a user