diff options
Diffstat (limited to 'util-linux')
-rw-r--r-- | util-linux/fdisk.c | 2 | ||||
-rw-r--r-- | util-linux/fdisk_osf.c | 7 | ||||
-rw-r--r-- | util-linux/fdisk_sun.c | 10 | ||||
-rw-r--r-- | util-linux/mount.c | 5 |
4 files changed, 10 insertions, 14 deletions
diff --git a/util-linux/fdisk.c b/util-linux/fdisk.c index 4ecbadf..8707891 100644 --- a/util-linux/fdisk.c +++ b/util-linux/fdisk.c @@ -20,8 +20,6 @@ # define USE_FEATURE_FDISK_BLKSIZE(a) #endif -#define SIZE(a) (sizeof(a)/sizeof((a)[0])) - #define DEFAULT_SECTOR_SIZE 512 #define MAX_SECTOR_SIZE 2048 #define SECTOR_SIZE 512 /* still used in osf/sgi/sun code */ diff --git a/util-linux/fdisk_osf.c b/util-linux/fdisk_osf.c index afb8459..9f0dc7f 100644 --- a/util-linux/fdisk_osf.c +++ b/util-linux/fdisk_osf.c @@ -163,7 +163,7 @@ static const char * const xbsd_dktypenames[] = { "floppy", 0 }; -#define BSD_DKMAXTYPES (sizeof(xbsd_dktypenames) / sizeof(xbsd_dktypenames[0]) - 1) + /* * Filesystem type and version. @@ -219,7 +219,6 @@ static const char *const xbsd_fstypes[] = { "\x10" "AdvFS", /* BSD_FS_ADVFS */ NULL }; -#define BSD_FSMAXTYPES (SIZE(xbsd_fstypes)-1) /* @@ -509,7 +508,7 @@ xbsd_print_disklabel(int show_all) #else printf("# %s:\n", partname(disk_device, xbsd_part_index+1, 0)); #endif - if ((unsigned) lp->d_type < BSD_DKMAXTYPES) + if ((unsigned) lp->d_type < ARRAY_SIZE(xbsd_dktypenames)-1) printf("type: %s\n", xbsd_dktypenames[lp->d_type]); else printf("type: %d\n", lp->d_type); @@ -571,7 +570,7 @@ xbsd_print_disklabel(int show_all) ); } - if ((unsigned) pp->p_fstype < BSD_FSMAXTYPES) + if ((unsigned) pp->p_fstype < ARRAY_SIZE(xbsd_fstypes)-1) printf("%8.8s", xbsd_fstypes[pp->p_fstype]); else printf("%8x", pp->p_fstype); diff --git a/util-linux/fdisk_sun.c b/util-linux/fdisk_sun.c index 2fa7b2b..d4614fd 100644 --- a/util-linux/fdisk_sun.c +++ b/util-linux/fdisk_sun.c @@ -207,7 +207,7 @@ sun_autoconfigure_scsi(void) if (!q) break; *q = '\0'; - for (i = 0; i < SIZE(sun_drives); i++) { + for (i = 0; i < ARRAY_SIZE(sun_drives); i++) { if (*sun_drives[i].vendor && strcasecmp(sun_drives[i].vendor, vendor)) continue; if (!strstr(model, sun_drives[i].model)) @@ -244,7 +244,7 @@ create_sunlabel(void) puts("Drive type\n" " ? auto configure\n" " 0 custom (with hardware detected defaults)"); - for (i = 0; i < SIZE(sun_drives); i++) { + for (i = 0; i < ARRAY_SIZE(sun_drives); i++) { printf(" %c %s%s%s\n", i + 'a', sun_drives[i].vendor, (*sun_drives[i].vendor) ? " " : "", @@ -255,11 +255,11 @@ create_sunlabel(void) if (c == '0') { break; } - if (c >= 'a' && c < 'a' + SIZE(sun_drives)) { + if (c >= 'a' && c < 'a' + ARRAY_SIZE(sun_drives)) { p = sun_drives + c - 'a'; break; } - if (c >= 'A' && c < 'A' + SIZE(sun_drives)) { + if (c >= 'A' && c < 'A' + ARRAY_SIZE(sun_drives)) { p = sun_drives + c - 'A'; break; } @@ -446,7 +446,7 @@ verify_sun(void) else array[i] = -1; } - qsort(array,SIZE(array),sizeof(array[0]), + qsort(array, ARRAY_SIZE(array), sizeof(array[0]), (int (*)(const void *,const void *)) verify_sun_cmp); if (array[0] == -1) { printf("No partitions defined\n"); diff --git a/util-linux/mount.c b/util-linux/mount.c index fe2f1d9..4dd1a85 100644 --- a/util-linux/mount.c +++ b/util-linux/mount.c @@ -120,7 +120,6 @@ struct { {"remount", MS_REMOUNT}, // action flag }; -#define VECTOR_SIZE(v) (sizeof(v) / sizeof((v)[0])) /* Append mount options to string */ static void append_mount_options(char **oldopts, const char *newopts) @@ -168,7 +167,7 @@ static int parse_mount_options(char *options, char **unrecognized) if (comma) *comma = 0; // Find this option in mount_options - for (i = 0; i < VECTOR_SIZE(mount_options); i++) { + for (i = 0; i < ARRAY_SIZE(mount_options); i++) { if (!strcasecmp(mount_options[i].name, options)) { long fl = mount_options[i].flags; if (fl < 0) flags &= fl; @@ -177,7 +176,7 @@ static int parse_mount_options(char *options, char **unrecognized) } } // If unrecognized not NULL, append unrecognized mount options */ - if (unrecognized && i == VECTOR_SIZE(mount_options)) { + if (unrecognized && i == ARRAY_SIZE(mount_options)) { // Add it to strflags, to pass on to kernel i = *unrecognized ? strlen(*unrecognized) : 0; *unrecognized = xrealloc(*unrecognized, i+strlen(options)+2); |