git » libfiu » commit 389fc18

preload/posix: constify read only data

author Tommi Rantala
2009-07-27 17:48:23 UTC
committer Alberto Bertogli
2009-07-27 19:02:18 UTC
parent 19c2ae6af1979cbb20d1ace6eff1e3911db189d5

preload/posix: constify read only data

The valid_errnos arrays are read only, so make them static const.

Signed-off-by: Tommi Rantala <tt.rantala@gmail.com>
Signed-off-by: Alberto Bertogli <albertito@blitiri.com.ar>

preload/posix/generate +1 -1
preload/posix/modules/posix.custom.c +1 -1

diff --git a/preload/posix/generate b/preload/posix/generate
index 0cc66e7..e7aac43 100755
--- a/preload/posix/generate
+++ b/preload/posix/generate
@@ -132,7 +132,7 @@ class Function:
 
 	def write_valid_errnos(self, f):
 		"Generates the code for the static list of valid errnos."
-		f.write("\tint valid_errnos[] = {\n")
+		f.write("\tstatic const int valid_errnos[] = {\n")
 		for e in self.valid_errnos:
 			f.write("\t  #ifdef %s\n" % e)
 			f.write("\t\t%s,\n" % e)
diff --git a/preload/posix/modules/posix.custom.c b/preload/posix/modules/posix.custom.c
index 2e5585f..84322a5 100644
--- a/preload/posix/modules/posix.custom.c
+++ b/preload/posix/modules/posix.custom.c
@@ -60,7 +60,7 @@ int open(const char *pathname, int flags, ...)
 	/* Use the normal macros to complete the function, now that we have a
 	 * set mode to something */
 
-	int valid_errnos[] = {
+	static const int valid_errnos[] = {
 	  #ifdef EACCESS
 		EACCES,
 	  #endif