#include <sys/ioctl.h>
#include <sys/stat.h>
#include <sys/utsname.h>
+
+#include "c.h"
#include "nls.h"
#include "blkdev.h"
#include "linux_version.h"
#include "wholedisk.h"
#include "gpt.h"
-#define SIZE(a) (sizeof(a)/sizeof(a[0]))
-
/*
* Table of contents:
* A. About seeking
exit(1);
}
-/*
- * GCC nonsense - needed for GCC 3.4.x with -O2
- *
- * Maybe just test with #if (__GNUC__ >= 3) && (__GNUC_MINOR__ >= 4) ?
- */
-#ifndef __GNUC_PREREQ
-#define __GNUC_PREREQ(x,y) 0
-#endif
-#if __GNUC_PREREQ(3,4)
-#define __attribute__used __attribute__ ((used))
-#else
-#define __attribute__used
-#endif
-
/*
* arm needs PACKED - use it everywhere?
*/
# define PACKED
#endif
-
/*
* A. About seeking
*/
cp = s->data + 0x1be;
- if (pno+4 >= SIZE(z->partitions)) {
+ if (pno+4 >= ARRAY_SIZE(z->partitions)) {
do_warn(_("too many partitions - ignoring those past nr (%d)\n"),
pno-1);
break;
bp = bp0 = &l->d_partitions[0];
while (bp - bp0 < BSD_MAXPARTITIONS && bp - bp0 < l->d_npartitions) {
- if (pno+1 >= SIZE(z->partitions)) {
+ if (pno+1 >= ARRAY_SIZE(z->partitions)) {
do_warn(_("too many partitions - ignoring those "
"past nr (%d)\n"), pno-1);
break;
ip++;
if (*ip == 0)
return fno;
- for(d = dumpflds; d-dumpflds < SIZE(dumpflds); d++) {
+ for(d = dumpflds; d-dumpflds < ARRAY_SIZE(dumpflds); d++) {
if (!strncmp(ip, d->fldname, strlen(d->fldname))) {
ip += strlen(d->fldname);
while(isspace(*ip))
/* read input line - skip blank lines when reading from a file */
do {
- fno = read_stdin(fields, line, SIZE(fields), SIZE(line));
+ fno = read_stdin(fields, line, ARRAY_SIZE(fields), ARRAY_SIZE(line));
} while(fno == RD_CMD || (fno == 0 && !interactive));
if (fno == RD_EOF) {
return -1;
eob = 0;
while (1) {
base = z->partno;
- if (base+4 > SIZE(z->partitions)) {
+ if (base+4 > ARRAY_SIZE(z->partitions)) {
do_warn(_("too many partitions\n"));
break;
}
int i;
struct part_desc *partitions = &(z->partitions[0]), *ep;
- for (i=0; i < SIZE(z->partitions); i++)
+ for (i=0; i < ARRAY_SIZE(z->partitions); i++)
partitions[i] = zero_part_desc;
z->partno = 0;