david/ipxe
david
/
ipxe
Archived
1
0
Fork 0

Make ref_get() return the reference, for cleaner code.

This commit is contained in:
Michael Brown 2007-07-08 22:02:45 +01:00
parent edded7546e
commit ed20fee0cf
2 changed files with 9 additions and 9 deletions

View File

@ -29,18 +29,18 @@
* Increment reference count * Increment reference count
* *
* @v refcnt Reference counter, or NULL * @v refcnt Reference counter, or NULL
* @ret refcnt Reference counter
* *
* If @c refcnt is NULL, no action is taken. * If @c refcnt is NULL, no action is taken.
*/ */
void ref_get ( struct refcnt *refcnt ) { struct refcnt * ref_get ( struct refcnt *refcnt ) {
if ( ! refcnt ) if ( refcnt ) {
return; refcnt->refcnt++;
DBGC2 ( refcnt, "REFCNT %p incremented to %d\n",
refcnt->refcnt++; refcnt, refcnt->refcnt );
}
DBGC2 ( refcnt, "REFCNT %p incremented to %d\n", return refcnt;
refcnt, refcnt->refcnt );
} }
/** /**

View File

@ -38,7 +38,7 @@ struct refcnt {
void ( * free ) ( struct refcnt *refcnt ); void ( * free ) ( struct refcnt *refcnt );
}; };
extern void ref_get ( struct refcnt *refcnt ); extern struct refcnt * ref_get ( struct refcnt *refcnt );
extern void ref_put ( struct refcnt *refcnt ); extern void ref_put ( struct refcnt *refcnt );
#endif /* _GPXE_REFCNT_H */ #endif /* _GPXE_REFCNT_H */