[augeas-devel] augeas: master - * src/hash.c (hash_alloc_insert): return 0/-1 for success/error

David Lutterkort lutter at fedoraproject.org
Thu Oct 1 00:23:20 UTC 2009


Gitweb:        http://git.fedorahosted.org/git/augeas.git?p=augeas.git;a=commitdiff;h=440c01afef56dbf659a5cf8fef24b14058e65ba3
Commit:        440c01afef56dbf659a5cf8fef24b14058e65ba3
Parent:        ce18a1ba007cd308c8de16ad56d215a8738d58ed
Author:        David Lutterkort <lutter at redhat.com>
AuthorDate:    Tue Sep 29 17:01:51 2009 -0700
Committer:     David Lutterkort <lutter at redhat.com>
CommitterDate: Wed Sep 30 12:10:56 2009 -0700

* src/hash.c (hash_alloc_insert): return 0/-1 for success/error

---
 src/hash.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/hash.c b/src/hash.c
index 892532f..42c320e 100644
--- a/src/hash.c
+++ b/src/hash.c
@@ -641,11 +641,11 @@ int hash_alloc_insert(hash_t *hash, const void *key, void *data)
     hnode_t *node = hash->allocnode(hash->context);
 
     if (node) {
-	hnode_init(node, data);
-	hash_insert(hash, node, key);
-	return 1;
+      hnode_init(node, data);
+      hash_insert(hash, node, key);
+      return 0;
     }
-    return 0;
+    return -1;
 }
 
 void hash_delete_free(hash_t *hash, hnode_t *node)
@@ -974,7 +974,7 @@ int main(void)
                     break;
 		}
 
-		if (!hash_alloc_insert(h, key, val)) {
+		if (hash_alloc_insert(h, key, val) < 0) {
 		    puts("hash_alloc_insert failed");
 		    free((void *) key);
 		    free(val);




More information about the augeas-devel mailing list