diff options
author | Jim Meyering <jim@meyering.net> | 1996-11-01 00:08:58 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 1996-11-01 00:08:58 +0000 |
commit | 24e88142ba9eb43230272fbeca1bc0fadc751ed1 (patch) | |
tree | 18e7c6aca8dbc0ac3ae536ce524a10cf3b2e867a /src | |
parent | f9cd2cf6e2114db921252b6cb379918c31900847 (diff) | |
download | coreutils-24e88142ba9eb43230272fbeca1bc0fadc751ed1.tar.xz |
(key_init): New function.
(main): Use key_init in the two places where it was open-coded.
Diffstat (limited to 'src')
-rw-r--r-- | src/sort.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/src/sort.c b/src/sort.c index b4dbe8bef..9db737f68 100644 --- a/src/sort.c +++ b/src/sort.c @@ -1705,6 +1705,13 @@ set_ordering (register const char *s, struct keyfield *key, return (char *) s; } +static void +key_init (struct keyfield *key) +{ + memset (key, 0, sizeof (*key)); + key->eword = -1; +} + int main (int argc, char **argv) { @@ -1775,11 +1782,7 @@ main (int argc, char **argv) if (key) insertkey (key); key = (struct keyfield *) xmalloc (sizeof (struct keyfield)); - key->eword = -1; - key->ignore = NULL; - key->translate = NULL; - key->skipsblanks = key->skipeblanks = 0; - key->numeric = key->general_numeric = key->month = key->reverse = 0; + key_init (key); s = argv[i] + 1; if (! (digits[UCHAR (*s)] || (*s == '.' && digits[UCHAR (s[1])]))) badfieldspec (argv[i]); @@ -1852,11 +1855,7 @@ key specifiers,\nthe +POS specifier must come first")); insertkey (key); key = (struct keyfield *) xmalloc (sizeof (struct keyfield)); - key->eword = -1; - key->ignore = NULL; - key->translate = NULL; - key->skipsblanks = key->skipeblanks = 0; - key->numeric = key->month = key->reverse = 0; + key_init (key); /* Get POS1. */ if (!digits[UCHAR (*s)]) badfieldspec (argv[i]); |