Browse Source

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

tags/v0.9.3
Michael Brown 17 years ago
parent
commit
ed20fee0cf
2 changed files with 9 additions and 9 deletions
  1. 8
    8
      src/core/refcnt.c
  2. 1
    1
      src/include/gpxe/refcnt.h

+ 8
- 8
src/core/refcnt.c View File

29
  * Increment reference count
29
  * Increment reference count
30
  *
30
  *
31
  * @v refcnt		Reference counter, or NULL
31
  * @v refcnt		Reference counter, or NULL
32
+ * @ret refcnt		Reference counter
32
  *
33
  *
33
  * If @c refcnt is NULL, no action is taken.
34
  * If @c refcnt is NULL, no action is taken.
34
  */
35
  */
35
-void ref_get ( struct refcnt *refcnt ) {
36
+struct refcnt * ref_get ( struct refcnt *refcnt ) {
36
 
37
 
37
-	if ( ! refcnt )
38
-		return;
39
-
40
-	refcnt->refcnt++;
41
-
42
-	DBGC2 ( refcnt, "REFCNT %p incremented to %d\n",
43
-		refcnt, refcnt->refcnt );
38
+	if ( refcnt ) {
39
+		refcnt->refcnt++;
40
+		DBGC2 ( refcnt, "REFCNT %p incremented to %d\n",
41
+			refcnt, refcnt->refcnt );
42
+	}
43
+	return refcnt;
44
 }
44
 }
45
 
45
 
46
 /**
46
 /**

+ 1
- 1
src/include/gpxe/refcnt.h View File

38
 	void ( * free ) ( struct refcnt *refcnt );
38
 	void ( * free ) ( struct refcnt *refcnt );
39
 };
39
 };
40
 
40
 
41
-extern void ref_get ( struct refcnt *refcnt );
41
+extern struct refcnt * ref_get ( struct refcnt *refcnt );
42
 extern void ref_put ( struct refcnt *refcnt );
42
 extern void ref_put ( struct refcnt *refcnt );
43
 
43
 
44
 #endif /* _GPXE_REFCNT_H */
44
 #endif /* _GPXE_REFCNT_H */

Loading…
Cancel
Save