public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] gentoo-projects commit in pax-utils: scanelf.c scanmacho.c
@ 2008-12-30 12:39 Mike Frysinger (vapier)
  0 siblings, 0 replies; 3+ messages in thread
From: Mike Frysinger (vapier) @ 2008-12-30 12:39 UTC (permalink / raw
  To: gentoo-commits

vapier      08/12/30 12:39:53

  Modified:             scanelf.c scanmacho.c
  Log:
  mark local state vars as static and drop unused ones

Revision  Changes    Path
1.203                pax-utils/scanelf.c

file : http://sources.gentoo.org/viewcvs.py/gentoo-projects/pax-utils/scanelf.c?rev=1.203&view=markup
plain: http://sources.gentoo.org/viewcvs.py/gentoo-projects/pax-utils/scanelf.c?rev=1.203&content-type=text/plain
diff : http://sources.gentoo.org/viewcvs.py/gentoo-projects/pax-utils/scanelf.c?r1=1.202&r2=1.203

Index: scanelf.c
===================================================================
RCS file: /var/cvsroot/gentoo-projects/pax-utils/scanelf.c,v
retrieving revision 1.202
retrieving revision 1.203
diff -u -r1.202 -r1.203
--- scanelf.c	30 Dec 2008 12:38:04 -0000	1.202
+++ scanelf.c	30 Dec 2008 12:39:53 -0000	1.203
@@ -1,13 +1,13 @@
 /*
  * Copyright 2003-2007 Gentoo Foundation
  * Distributed under the terms of the GNU General Public License v2
- * $Header: /var/cvsroot/gentoo-projects/pax-utils/scanelf.c,v 1.202 2008/12/30 12:38:04 vapier Exp $
+ * $Header: /var/cvsroot/gentoo-projects/pax-utils/scanelf.c,v 1.203 2008/12/30 12:39:53 vapier Exp $
  *
  * Copyright 2003-2007 Ned Ludd        - <solar@gentoo.org>
  * Copyright 2004-2007 Mike Frysinger  - <vapier@gentoo.org>
  */
 
-static const char *rcsid = "$Id: scanelf.c,v 1.202 2008/12/30 12:38:04 vapier Exp $";
+static const char *rcsid = "$Id: scanelf.c,v 1.203 2008/12/30 12:39:53 vapier Exp $";
 const char * const argv0 = "scanelf";
 
 #include "paxinc.h"
@@ -70,13 +70,13 @@
 static char **qa_execstack = NULL;
 static char **qa_wx_load = NULL;
 
-int match_bits = 0;
-unsigned int match_perms = 0;
-caddr_t ldcache = 0;
-size_t ldcache_size = 0;
-unsigned long setpax = 0UL;
+static int match_bits = 0;
+static unsigned int match_perms = 0;
+static caddr_t ldcache = 0;
+static size_t ldcache_size = 0;
+static unsigned long setpax = 0UL;
 
-int has_objdump = 0;
+static int has_objdump = 0;
 
 static char *getstr_perms(const char *fname);
 static char *getstr_perms(const char *fname)



1.9                  pax-utils/scanmacho.c

file : http://sources.gentoo.org/viewcvs.py/gentoo-projects/pax-utils/scanmacho.c?rev=1.9&view=markup
plain: http://sources.gentoo.org/viewcvs.py/gentoo-projects/pax-utils/scanmacho.c?rev=1.9&content-type=text/plain
diff : http://sources.gentoo.org/viewcvs.py/gentoo-projects/pax-utils/scanmacho.c?r1=1.8&r2=1.9

Index: scanmacho.c
===================================================================
RCS file: /var/cvsroot/gentoo-projects/pax-utils/scanmacho.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- scanmacho.c	30 Dec 2008 12:34:28 -0000	1.8
+++ scanmacho.c	30 Dec 2008 12:39:53 -0000	1.9
@@ -1,7 +1,7 @@
 /*
  * Copyright 2008 Gentoo Foundation
  * Distributed under the terms of the GNU General Public License v2
- * $Header: /var/cvsroot/gentoo-projects/pax-utils/scanmacho.c,v 1.8 2008/12/30 12:34:28 vapier Exp $
+ * $Header: /var/cvsroot/gentoo-projects/pax-utils/scanmacho.c,v 1.9 2008/12/30 12:39:53 vapier Exp $
  *
  * based on scanelf by:
  * Copyright 2003-2007 Ned Ludd        - <solar@gentoo.org>
@@ -10,7 +10,7 @@
  *                2008 Fabian Groffen  - <grobian@gentoo.org>
  */
 
-static const char *rcsid = "$Id: scanmacho.c,v 1.8 2008/12/30 12:34:28 vapier Exp $";
+static const char *rcsid = "$Id: scanmacho.c,v 1.9 2008/12/30 12:39:53 vapier Exp $";
 const char * const argv0 = "scanmacho";
 
 #include "paxinc.h"
@@ -50,13 +50,8 @@
 static char *search_path = NULL;
 static char g_match = 0;
 
-int match_bits = 0;
-unsigned int match_perms = 0;
-caddr_t ldcache = 0;
-size_t ldcache_size = 0;
-unsigned long setpax = 0UL;
-
-int has_objdump = 0;
+static int match_bits = 0;
+static unsigned int match_perms = 0;
 
 static char *getstr_perms(const char *fname);
 static char *getstr_perms(const char *fname)






^ permalink raw reply	[flat|nested] 3+ messages in thread

* [gentoo-commits] gentoo-projects commit in pax-utils: scanelf.c scanmacho.c
@ 2008-12-30 13:09 Mike Frysinger (vapier)
  0 siblings, 0 replies; 3+ messages in thread
From: Mike Frysinger (vapier) @ 2008-12-30 13:09 UTC (permalink / raw
  To: gentoo-commits

vapier      08/12/30 13:09:20

  Modified:             scanelf.c scanmacho.c
  Log:
  fixup const handling in getstr_perms()

Revision  Changes    Path
1.204                pax-utils/scanelf.c

file : http://sources.gentoo.org/viewcvs.py/gentoo-projects/pax-utils/scanelf.c?rev=1.204&view=markup
plain: http://sources.gentoo.org/viewcvs.py/gentoo-projects/pax-utils/scanelf.c?rev=1.204&content-type=text/plain
diff : http://sources.gentoo.org/viewcvs.py/gentoo-projects/pax-utils/scanelf.c?r1=1.203&r2=1.204

Index: scanelf.c
===================================================================
RCS file: /var/cvsroot/gentoo-projects/pax-utils/scanelf.c,v
retrieving revision 1.203
retrieving revision 1.204
diff -u -r1.203 -r1.204
--- scanelf.c	30 Dec 2008 12:39:53 -0000	1.203
+++ scanelf.c	30 Dec 2008 13:09:20 -0000	1.204
@@ -1,13 +1,13 @@
 /*
  * Copyright 2003-2007 Gentoo Foundation
  * Distributed under the terms of the GNU General Public License v2
- * $Header: /var/cvsroot/gentoo-projects/pax-utils/scanelf.c,v 1.203 2008/12/30 12:39:53 vapier Exp $
+ * $Header: /var/cvsroot/gentoo-projects/pax-utils/scanelf.c,v 1.204 2008/12/30 13:09:20 vapier Exp $
  *
  * Copyright 2003-2007 Ned Ludd        - <solar@gentoo.org>
  * Copyright 2004-2007 Mike Frysinger  - <vapier@gentoo.org>
  */
 
-static const char *rcsid = "$Id: scanelf.c,v 1.203 2008/12/30 12:39:53 vapier Exp $";
+static const char *rcsid = "$Id: scanelf.c,v 1.204 2008/12/30 13:09:20 vapier Exp $";
 const char * const argv0 = "scanelf";
 
 #include "paxinc.h"
@@ -78,18 +78,17 @@
 
 static int has_objdump = 0;
 
-static char *getstr_perms(const char *fname);
-static char *getstr_perms(const char *fname)
+static const char *getstr_perms(const char *fname)
 {
 	struct stat st;
 	static char buf[8];
 
-	if ((stat(fname, &st)) == (-1))
-		return (char *) "";
+	if (stat(fname, &st) == -1)
+		return "";
 
 	snprintf(buf, sizeof(buf), "%o", st.st_mode);
 
-	return (char *) buf + 2;
+	return buf + 2;
 }
 
 /* find the path to a file by name */
@@ -108,7 +107,7 @@
 		*p = 0;
 		if (access(fullpath, R_OK) != (-1)) {
 			free(path);
-			return (char *) fullpath;
+			return fullpath;
 		}
 	}
 	free(path);



1.10                 pax-utils/scanmacho.c

file : http://sources.gentoo.org/viewcvs.py/gentoo-projects/pax-utils/scanmacho.c?rev=1.10&view=markup
plain: http://sources.gentoo.org/viewcvs.py/gentoo-projects/pax-utils/scanmacho.c?rev=1.10&content-type=text/plain
diff : http://sources.gentoo.org/viewcvs.py/gentoo-projects/pax-utils/scanmacho.c?r1=1.9&r2=1.10

Index: scanmacho.c
===================================================================
RCS file: /var/cvsroot/gentoo-projects/pax-utils/scanmacho.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- scanmacho.c	30 Dec 2008 12:39:53 -0000	1.9
+++ scanmacho.c	30 Dec 2008 13:09:20 -0000	1.10
@@ -1,7 +1,7 @@
 /*
  * Copyright 2008 Gentoo Foundation
  * Distributed under the terms of the GNU General Public License v2
- * $Header: /var/cvsroot/gentoo-projects/pax-utils/scanmacho.c,v 1.9 2008/12/30 12:39:53 vapier Exp $
+ * $Header: /var/cvsroot/gentoo-projects/pax-utils/scanmacho.c,v 1.10 2008/12/30 13:09:20 vapier Exp $
  *
  * based on scanelf by:
  * Copyright 2003-2007 Ned Ludd        - <solar@gentoo.org>
@@ -10,7 +10,7 @@
  *                2008 Fabian Groffen  - <grobian@gentoo.org>
  */
 
-static const char *rcsid = "$Id: scanmacho.c,v 1.9 2008/12/30 12:39:53 vapier Exp $";
+static const char *rcsid = "$Id: scanmacho.c,v 1.10 2008/12/30 13:09:20 vapier Exp $";
 const char * const argv0 = "scanmacho";
 
 #include "paxinc.h"
@@ -53,18 +53,17 @@
 static int match_bits = 0;
 static unsigned int match_perms = 0;
 
-static char *getstr_perms(const char *fname);
-static char *getstr_perms(const char *fname)
+static const char *getstr_perms(const char *fname)
 {
 	struct stat st;
 	static char buf[8];
 
-	if ((stat(fname, &st)) == (-1))
-		return (char *) "";
+	if (stat(fname, &st) == -1)
+		return "";
 
 	snprintf(buf, sizeof(buf), "%o", st.st_mode);
 
-	return (char *) buf + 2;
+	return buf + 2;
 }
 
 static const char *macho_file_needed_lib(






^ permalink raw reply	[flat|nested] 3+ messages in thread

* [gentoo-commits] gentoo-projects commit in pax-utils: scanelf.c scanmacho.c
@ 2009-03-15  8:56 Mike Frysinger (vapier)
  0 siblings, 0 replies; 3+ messages in thread
From: Mike Frysinger (vapier) @ 2009-03-15  8:56 UTC (permalink / raw
  To: gentoo-commits

vapier      09/03/15 08:56:14

  Modified:             scanelf.c scanmacho.c
  Log:
  trick gcc into not warning about write() when outputting the banner -- we dont care if this fails

Revision  Changes    Path
1.210                pax-utils/scanelf.c

file : http://sources.gentoo.org/viewcvs.py/gentoo-projects/pax-utils/scanelf.c?rev=1.210&view=markup
plain: http://sources.gentoo.org/viewcvs.py/gentoo-projects/pax-utils/scanelf.c?rev=1.210&content-type=text/plain
diff : http://sources.gentoo.org/viewcvs.py/gentoo-projects/pax-utils/scanelf.c?r1=1.209&r2=1.210

Index: scanelf.c
===================================================================
RCS file: /var/cvsroot/gentoo-projects/pax-utils/scanelf.c,v
retrieving revision 1.209
retrieving revision 1.210
diff -u -r1.209 -r1.210
--- scanelf.c	15 Mar 2009 08:53:29 -0000	1.209
+++ scanelf.c	15 Mar 2009 08:56:14 -0000	1.210
@@ -1,13 +1,13 @@
 /*
  * Copyright 2003-2007 Gentoo Foundation
  * Distributed under the terms of the GNU General Public License v2
- * $Header: /var/cvsroot/gentoo-projects/pax-utils/scanelf.c,v 1.209 2009/03/15 08:53:29 vapier Exp $
+ * $Header: /var/cvsroot/gentoo-projects/pax-utils/scanelf.c,v 1.210 2009/03/15 08:56:14 vapier Exp $
  *
  * Copyright 2003-2007 Ned Ludd        - <solar@gentoo.org>
  * Copyright 2004-2007 Mike Frysinger  - <vapier@gentoo.org>
  */
 
-static const char *rcsid = "$Id: scanelf.c,v 1.209 2009/03/15 08:53:29 vapier Exp $";
+static const char *rcsid = "$Id: scanelf.c,v 1.210 2009/03/15 08:56:14 vapier Exp $";
 const char * const argv0 = "scanelf";
 
 #include "paxinc.h"
@@ -1103,7 +1103,7 @@
 }
 
 /* scan an elf file and show all the fun stuff */
-#define prints(str) write(fileno(stdout), str, strlen(str))
+#define prints(str) ({ ssize_t ret = write(fileno(stdout), str, strlen(str)); ret; })
 static int scanelf_elfobj(elfobj *elf)
 {
 	unsigned long i;



1.14                 pax-utils/scanmacho.c

file : http://sources.gentoo.org/viewcvs.py/gentoo-projects/pax-utils/scanmacho.c?rev=1.14&view=markup
plain: http://sources.gentoo.org/viewcvs.py/gentoo-projects/pax-utils/scanmacho.c?rev=1.14&content-type=text/plain
diff : http://sources.gentoo.org/viewcvs.py/gentoo-projects/pax-utils/scanmacho.c?r1=1.13&r2=1.14

Index: scanmacho.c
===================================================================
RCS file: /var/cvsroot/gentoo-projects/pax-utils/scanmacho.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- scanmacho.c	30 Dec 2008 13:34:46 -0000	1.13
+++ scanmacho.c	15 Mar 2009 08:56:14 -0000	1.14
@@ -1,7 +1,7 @@
 /*
  * Copyright 2008 Gentoo Foundation
  * Distributed under the terms of the GNU General Public License v2
- * $Header: /var/cvsroot/gentoo-projects/pax-utils/scanmacho.c,v 1.13 2008/12/30 13:34:46 vapier Exp $
+ * $Header: /var/cvsroot/gentoo-projects/pax-utils/scanmacho.c,v 1.14 2009/03/15 08:56:14 vapier Exp $
  *
  * based on scanelf by:
  * Copyright 2003-2007 Ned Ludd        - <solar@gentoo.org>
@@ -10,7 +10,7 @@
  *                2008 Fabian Groffen  - <grobian@gentoo.org>
  */
 
-static const char *rcsid = "$Id: scanmacho.c,v 1.13 2008/12/30 13:34:46 vapier Exp $";
+static const char *rcsid = "$Id: scanmacho.c,v 1.14 2009/03/15 08:56:14 vapier Exp $";
 const char * const argv0 = "scanmacho";
 
 #include "paxinc.h"
@@ -152,7 +152,7 @@
 }
 
 /* scan a macho file and show all the fun stuff */
-#define prints(str) write(fileno(stdout), str, strlen(str))
+#define prints(str) ({ ssize_t ret = write(fileno(stdout), str, strlen(str)); ret; })
 static int scanmacho_fatobj(fatobj *fobj)
 {
 	unsigned long i;






^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-03-15  8:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-30 12:39 [gentoo-commits] gentoo-projects commit in pax-utils: scanelf.c scanmacho.c Mike Frysinger (vapier)
  -- strict thread matches above, loose matches on Subject: below --
2008-12-30 13:09 Mike Frysinger (vapier)
2009-03-15  8:56 Mike Frysinger (vapier)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox