aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRodolfo Garcia <kix@kix.es>2010-01-03 23:48:04 +0100
committerRafael J. Wysocki <rjw@sisk.pl>2010-01-03 23:48:04 +0100
commit9154fbd96731f84090ce8614a8ad6ff88f5842d7 (patch)
tree7afc16cac08d597b7b1b82308bf8b5a1487c5973
parenta93fe5edcb806c866ca752510a88e25a053e54ea (diff)
downloadsuspend-utils-9154fbd96731f84090ce8614a8ad6ff88f5842d7.tar.gz
Use a symbol instead of a hard coded value for array sizes
Use a symbol for the sizes of some whitelist-related arrays instead of hard-coded values. Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
-rw-r--r--dmidecode.c3
-rw-r--r--s2ram-x86.c2
-rw-r--r--whitelist.h5
3 files changed, 6 insertions, 4 deletions
diff --git a/dmidecode.c b/dmidecode.c
index edc6d45..43e317a 100644
--- a/dmidecode.c
+++ b/dmidecode.c
@@ -18,6 +18,7 @@
#include <string.h>
#include <stdlib.h>
#include <sys/mman.h>
+#include <whitelist.h>
typedef unsigned char u8;
typedef unsigned short u16;
@@ -31,10 +32,8 @@ struct dmi_header
};
#ifdef S2RAM
-extern char bios_version[1024], sys_vendor[1024], sys_product[1024], sys_version[1024];
#define PRINTF(a...)
#else
-char bios_version[1024], sys_vendor[1024], sys_product[1024], sys_version[1024];
#define PRINTF printf
#endif
diff --git a/s2ram-x86.c b/s2ram-x86.c
index 85545f4..67a6787 100644
--- a/s2ram-x86.c
+++ b/s2ram-x86.c
@@ -35,8 +35,6 @@ static int flags, vbe_mode = -1, dmi_scanned;
static int force;
static int fb_nosuspend;
-char bios_version[1024], sys_vendor[1024], sys_product[1024], sys_version[1024];
-
/* return codes for s2ram_is_supported */
#define S2RAM_OK 0
#define S2RAM_FAIL 1
diff --git a/whitelist.h b/whitelist.h
index a7224ed..fc26a40 100644
--- a/whitelist.h
+++ b/whitelist.h
@@ -3,6 +3,9 @@
* and all the workarounds
*/
+/* Item size */
+#define ITEMSZ 1024
+
/* flags for the whitelist */
#define S3_BIOS 0x01 /* machine needs acpi_sleep=s3_bios */
#define S3_MODE 0x02 /* machine needs acpi_sleep=s3_mode */
@@ -23,5 +26,7 @@ struct machine_entry
unsigned int flags;
};
+char bios_version[ITEMSZ], sys_vendor[ITEMSZ], sys_product[ITEMSZ], sys_version[ITEMSZ];
+
extern char *whitelist_version;
extern struct machine_entry whitelist[];