[ltrace-commits] 05/13: clarified some int return code checking

Petr Machata pmachata-guest at moszumanska.debian.org
Fri Jul 25 11:05:29 UTC 2014


This is an automated email from the git hooks/post-receive script.

pmachata-guest pushed a commit to branch master
in repository ltrace.

commit 245eebb7a2e37086daba95a7f68e4b5f2ec65ede
Author: Dima Kogan <dima at secretsauce.net>
Date:   Wed Jun 25 21:50:00 2014 -0700

    clarified some int return code checking
---
 library.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/library.c b/library.c
index c2f3fd1..562b52a 100644
--- a/library.c
+++ b/library.c
@@ -372,17 +372,16 @@ static int
 library_exported_names_clone(struct library_exported_names *retp,
 			     const struct library_exported_names *names)
 {
-	return
-		DICT_CLONE(&retp->names, &names->names,
+	return (DICT_CLONE(&retp->names, &names->names,
 			   const char*, uint64_t,
 			   dict_clone_string, dtor_string,
 			   NULL, NULL,
-			   NULL) ||
+			   NULL) < 0  ||
 		DICT_CLONE(&retp->addrs, &names->addrs,
 			   uint64_t, struct vect*,
 			   NULL, NULL,
 			   clone_vect, dtor_vect,
-			   NULL);
+			   NULL) < 0) ? -1 : 0;
 }
 
 int library_exported_names_push(struct library_exported_names *names,
@@ -397,7 +396,7 @@ int library_exported_names_push(struct library_exported_names *names,
 
 	// push to the name->addr map
 	int result = DICT_INSERT(&names->names, &name, &addr);
-	if (result == 1) {
+	if (result > 0) {
 		// This symbol is already present in the table. This library has
 		// multiple copies of this symbol (probably corresponding to
 		// different symbol versions). I should handle this gracefully
@@ -422,7 +421,8 @@ int library_exported_names_push(struct library_exported_names *names,
 			return -1;
 		VECT_INIT(aliases, const char*);
 		result = DICT_INSERT(&names->addrs, &addr, &aliases);
-		if (result != 0)
+		assert(result <= 0);
+		if (result < 0)
 			return result;
 	}
 	else

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/collab-maint/ltrace.git



More information about the ltrace-commits mailing list