diff options
author | Jim Meyering <jim@meyering.net> | 2003-11-04 09:27:19 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 2003-11-04 09:27:19 +0000 |
commit | eab4bc527834d55459659f4438fdb34ddb2efd86 (patch) | |
tree | 5fbaac5adb2bb7ecbedff1d7ab2f6ca7a431ae57 | |
parent | 59436e7b92f75f6379568a397f13cba1df1eb0f2 (diff) | |
download | coreutils-eab4bc527834d55459659f4438fdb34ddb2efd86.tar.xz |
(decode_format_string): Remove unnecessary casts.
Use more maintainable `sizeof *var'.
(main): Call decode_format_string rather than decode_one_format,
now that `spec' may be NULL.
-rw-r--r-- | src/od.c | 11 |
1 files changed, 4 insertions, 7 deletions
@@ -1038,13 +1038,10 @@ decode_format_string (const char *s) assert (s != next); s = next; - if (n_specs >= n_specs_allocated) - { - spec = x2nrealloc (spec, &n_specs_allocated, sizeof (struct tspec)); - } + if (n_specs_allocated <= n_specs) + spec = x2nrealloc (spec, &n_specs_allocated, sizeof *spec); - memcpy ((char *) &spec[n_specs], (char *) &tspec, - sizeof (struct tspec)); + memcpy (&spec[n_specs], &tspec, sizeof *spec); ++n_specs; } @@ -1928,7 +1925,7 @@ it must be one character from [doxn]"), if (n_specs == 0) { - if (decode_one_format ("o2", "o2", NULL, &(spec[0]))) + if (decode_format_string ("o2")) { /* This happens on Cray systems that don't have a 2-byte integral type. */ |