There are many functions that take ownership of the I/O buffer they
are passed as a parameter. The caller should not retain a pointer to
the I/O buffer. Use iob_disown() to automatically nullify the
caller's pointer, e.g.:
xfer_deliver_iob ( xfer, iob_disown ( iobuf ) );
This will ensure that iobuf is set to NULL for any code after the call
to xfer_deliver_iob().
iob_disown() is currently used only in places where it simplifies the
code, by avoiding an extra line explicitly setting the I/O buffer
pointer to NULL. It should ideally be used with each call to any
function that takes ownership of an I/O buffer. (The SSA
optimisations will ensure that use of iob_disown() gets optimised away
in cases where the caller makes no further use of the I/O buffer
pointer anyway.)
If gcc ever introduces an __attribute__((free)), indicating that use
of a function argument after a function call should generate a
warning, then we should use this to identify all applicable function
call sites, and add iob_disown() as necessary.
tags/v0.9.7
|
||
| 482 | 482 |
|
| 483 | 483 |
|
| 484 | 484 |
|
| 485 |
|
|
| 486 |
|
|
| 485 |
|
|
| 487 | 486 |
|
| 488 | 487 |
|
| 489 | 488 |
|
|
||
| 199 | 199 |
|
| 200 | 200 |
|
| 201 | 201 |
|
| 202 |
|
|
| 203 |
|
|
| 204 |
|
|
| 205 |
|
|
| 206 |
|
|
| 207 |
|
|
| 208 |
|
|
| 209 |
|
|
| 210 |
|
|
| 211 |
|
|
| 212 |
|
|
| 213 |
|
|
| 214 |
|
|
| 215 |
|
|
| 216 |
|
|
| 217 |
|
|
| 218 |
|
|
| 219 |
|
|
| 220 |
|
|
| 221 |
|
|
| 202 | 222 |
|
| 203 | 223 |
|
| 204 | 224 |
|
|
||
| 602 | 602 |
|
| 603 | 603 |
|
| 604 | 604 |
|
| 605 |
|
|
| 605 |
|
|
| 606 | 606 |
|
| 607 | 607 |
|
| 608 |
|
|
| 609 | 608 |
|
| 610 | 609 |
|
| 611 | 610 |
|
|
||
| 265 | 265 |
|
| 266 | 266 |
|
| 267 | 267 |
|
| 268 |
|
|
| 269 |
|
|
| 268 |
|
|
| 269 |
|
|
| 270 | 270 |
|
| 271 | 271 |
|
| 272 | 272 |
|
|
||
| 340 | 340 |
|
| 341 | 341 |
|
| 342 | 342 |
|
| 343 |
|
|
| 344 |
|
|
| 343 |
|
|
| 345 | 344 |
|
| 346 | 345 |
|
| 347 | 346 |
|
|
||
| 328 | 328 |
|
| 329 | 329 |
|
| 330 | 330 |
|
| 331 |
|
|
| 332 |
|
|
| 331 |
|
|
| 333 | 332 |
|
| 334 | 333 |
|
| 335 | 334 |
|
|
||
| 976 | 976 |
|
| 977 | 977 |
|
| 978 | 978 |
|
| 979 |
|
|
| 980 |
|
|
| 981 |
|
|
| 979 |
|
|
| 980 |
|
|
| 982 | 981 |
|
| 983 | 982 |
|
| 984 | 983 |
|
|
||
| 763 | 763 |
|
| 764 | 764 |
|
| 765 | 765 |
|
| 766 |
|
|
| 767 |
|
|
| 768 |
|
|
| 766 |
|
|
| 767 |
|
|
| 769 | 768 |
|
| 770 | 769 |
|
| 771 | 770 |
|
|
||
| 887 | 886 |
|
| 888 | 887 |
|
| 889 | 888 |
|
| 890 |
|
|
| 891 |
|
|
| 889 |
|
|
| 892 | 890 |
|
| 893 | 891 |
|
| 894 | 892 |
|