diff options
-rw-r--r-- | ChangeLog | 55 | ||||
-rw-r--r-- | argp/argp-fmtstream.c | 40 | ||||
-rw-r--r-- | argp/argp-help.c | 64 | ||||
-rw-r--r-- | catgets/gencat.c | 34 | ||||
-rw-r--r-- | elf/dl-error.c | 8 | ||||
-rw-r--r-- | elf/dl-load.c | 36 | ||||
-rw-r--r-- | elf/dl-open.c | 6 | ||||
-rw-r--r-- | iconv/gconv_conf.c | 12 | ||||
-rw-r--r-- | iconv/iconv_prog.c | 12 | ||||
-rw-r--r-- | io/fts.c | 10 | ||||
-rw-r--r-- | io/ftw.c | 80 | ||||
-rw-r--r-- | locale/programs/stringtrans.c | 7 | ||||
-rw-r--r-- | misc/getpass.c | 22 | ||||
-rw-r--r-- | posix/getconf.c | 12 | ||||
-rw-r--r-- | posix/getopt.c | 22 | ||||
-rw-r--r-- | posix/wordexp.c | 24 | ||||
-rw-r--r-- | stdio-common/_itoa.c | 47 | ||||
-rw-r--r-- | stdio-common/printf_fp.c | 64 | ||||
-rw-r--r-- | stdio-common/vfscanf.c | 12 | ||||
-rw-r--r-- | stdlib/strfmon.c | 54 | ||||
-rw-r--r-- | string/strcoll.c | 10 | ||||
-rw-r--r-- | string/strxfrm.c | 5 | ||||
-rw-r--r-- | sysdeps/generic/glob.c | 150 | ||||
-rw-r--r-- | sysdeps/posix/getaddrinfo.c | 10 | ||||
-rw-r--r-- | sysdeps/powerpc/dl-machine.h | 2 | ||||
-rw-r--r-- | time/mktime.c | 4 | ||||
-rw-r--r-- | time/strftime.c | 6 | ||||
-rw-r--r-- | wcsmbs/wcstok.c | 16 |
28 files changed, 465 insertions, 359 deletions
diff --git a/ChangeLog b/ChangeLog index 56143e375b..436a362a19 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,13 +1,64 @@ -Wed Sep 9 10:34:06 1998 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> +1998-09-09 09:32 Ulrich Drepper <drepper@cygnus.com> + + * sysdeps/powerpc/dl-machine.h (elf_machine_rela): Make function + inline. + +1998-09-07 Paul Eggert <eggert@twinsun.com> + + * time/mktime.c (__EXTENSIONS__): Define if not defined. + (_REENTRANT): Remove. It has undesirable consequences in + Solaris 2.6 (e.g. it turns off the putc macro). Defining + __EXTENSIONS__ makes localtime_r and gmtime_r visible, which + is what we want. + * time/strftime.c: Likewise. + +1998-09-08 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> + + * elf/dl-error.c: Fix spelling. + +1998-09-08 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> + + * stdlib/strfmon.c: Quiet -Wparentheses warnings. + * stdio-common/_itoa.c: Likewise. + * stdio-common/printf_fp.c: Likewise. + * stdio-common/vfscanf.c: Likewise. + * wcsmbs/wcstok.c: Likewise. + * sysdeps/generic/glob.c: Likewise. + * posix/getopt.c: Likewise. + * sysdeps/posix/getaddrinfo.c: Likewise. + * posix/wordexp.c: Likewise. + * io/ftw.c: Likewise. + * io/fts.c: Likewise. + * misc/getpass.c: Likewise. + * iconv/gconv_conf.c: Likewise. + * argp/argp-fmtstream.c: Likewise. + * argp/argp-help.c: Likewise. + * elf/dl-load.c: Likewise. + * locale/programs/stringtrans.c: Likewise. + * catgets/gencat.c: Likewise. + * posix/getconf.c: Likewise. + * iconv/gconv_conf.c: Likewise. + * iconv/iconv_prog.c: Likewise. + + * string/strcoll.c: Optimize a few expressions. + * string/strxfrm.c: Likewise. + +1998-09-08 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> + + * elf/dl-open.c (dl_open_worker): Move decl of new_global up one + level to avoid uninit variable warning. + +1998-09-09 10:34 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> * sysdeps/m68k/dl-machine.h(RTLD_START): Push _dl_main_searchlist - instead of _dl_default_scope[2] as argument to _dl_init_next. + instead of _dl_default_scope[2] as argument to _dl_init_next. * sysdeps/m68k/fpu/bits/mathinline.h (isinf): Avoid conflict with C9x macro. 1998-09-08 Ulrich Drepper <drepper@cygnus.com> + Fix compatibility problems introduced in last change. * csu/initfini.c: Don't define __gmon_start__ if WEAK_GMON_START is defined. * sysdeps/unix/sysv/linux/i386/Makefile [subdir==csu]: Add diff --git a/argp/argp-fmtstream.c b/argp/argp-fmtstream.c index 1649f15cbb..d563c31b8e 100644 --- a/argp/argp-fmtstream.c +++ b/argp/argp-fmtstream.c @@ -253,25 +253,27 @@ __argp_fmtstream_update (argp_fmtstream_t fs) if (nextline == buf + len + 1 ? fs->end - nl < fs->wmargin + 1 : nextline - (nl + 1) < fs->wmargin) - /* The margin needs more blanks than we removed. */ - if (fs->end - fs->p > fs->wmargin + 1) - /* Make some space for them. */ - { - size_t mv = fs->p - nextline; - memmove (nl + 1 + fs->wmargin, nextline, mv); - nextline = nl + 1 + fs->wmargin; - len = nextline + mv - buf; - *nl++ = '\n'; - } - else - /* Output the first line so we can use the space. */ - { - if (nl > fs->buf) - fwrite_unlocked (fs->buf, 1, nl - fs->buf, fs->stream); - putc_unlocked ('\n', fs->stream); - len += buf - fs->buf; - nl = buf = fs->buf; - } + { + /* The margin needs more blanks than we removed. */ + if (fs->end - fs->p > fs->wmargin + 1) + /* Make some space for them. */ + { + size_t mv = fs->p - nextline; + memmove (nl + 1 + fs->wmargin, nextline, mv); + nextline = nl + 1 + fs->wmargin; + len = nextline + mv - buf; + *nl++ = '\n'; + } + else + /* Output the first line so we can use the space. */ + { + if (nl > fs->buf) + fwrite_unlocked (fs->buf, 1, nl - fs->buf, fs->stream); + putc_unlocked ('\n', fs->stream); + len += buf - fs->buf; + nl = buf = fs->buf; + } + } else /* We can fit the newline and blanks in before the next word. */ diff --git a/argp/argp-help.c b/argp/argp-help.c index 8fe3b2e584..9a1c05387f 100644 --- a/argp/argp-help.c +++ b/argp/argp-help.c @@ -183,14 +183,16 @@ fill_in_uparams (const struct argp_state *state) } if (unspec) - if (var[0] == 'n' && var[1] == 'o' && var[2] == '-') - { - val = 0; - var += 3; - var_len -= 3; - } - else - val = 1; + { + if (var[0] == 'n' && var[1] == 'o' && var[2] == '-') + { + val = 0; + var += 3; + var_len -= 3; + } + else + val = 1; + } else if (isdigit (*arg)) { val = atoi (arg); @@ -709,20 +711,22 @@ hol_entry_cmp (const struct hol_entry *entry1, int group1 = entry1->group, group2 = entry2->group; if (entry1->cluster != entry2->cluster) - /* The entries are not within the same cluster, so we can't compare them - directly, we have to use the appropiate clustering level too. */ - if (! entry1->cluster) - /* ENTRY1 is at the `base level', not in a cluster, so we have to - compare it's group number with that of the base cluster in which - ENTRY2 resides. Note that if they're in the same group, the - clustered option always comes laster. */ - return group_cmp (group1, hol_cluster_base (entry2->cluster)->group, -1); - else if (! entry2->cluster) - /* Likewise, but ENTRY2's not in a cluster. */ - return group_cmp (hol_cluster_base (entry1->cluster)->group, group2, 1); - else - /* Both entries are in clusters, we can just compare the clusters. */ - return hol_cluster_cmp (entry1->cluster, entry2->cluster); + { + /* The entries are not within the same cluster, so we can't compare them + directly, we have to use the appropiate clustering level too. */ + if (! entry1->cluster) + /* ENTRY1 is at the `base level', not in a cluster, so we have to + compare it's group number with that of the base cluster in which + ENTRY2 resides. Note that if they're in the same group, the + clustered option always comes laster. */ + return group_cmp (group1, hol_cluster_base (entry2->cluster)->group, -1); + else if (! entry2->cluster) + /* Likewise, but ENTRY2's not in a cluster. */ + return group_cmp (hol_cluster_base (entry1->cluster)->group, group2, 1); + else + /* Both entries are in clusters, we can just compare the clusters. */ + return hol_cluster_cmp (entry1->cluster, entry2->cluster); + } else if (group1 == group2) /* The entries are both in the same cluster and group, so compare them alphabetically. */ @@ -1115,13 +1119,15 @@ hol_entry_help (struct hol_entry *entry, const struct argp_state *state, __argp_fmtstream_set_lmargin (stream, 0); if (pest.first) - /* Didn't print any switches, what's up? */ - if (!oshort (real) && !real->name) - /* This is a group header, print it nicely. */ - print_header (real->doc, entry->argp, &pest); - else - /* Just a totally shadowed option or null header; print nothing. */ - goto cleanup; /* Just return, after cleaning up. */ + { + /* Didn't print any switches, what's up? */ + if (!oshort (real) && !real->name) + /* This is a group header, print it nicely. */ + print_header (real->doc, entry->argp, &pest); + else + /* Just a totally shadowed option or null header; print nothing. */ + goto cleanup; /* Just return, after cleaning up. */ + } else { const char *tstr = real->doc ? dgettext (state->root_argp->argp_domain, diff --git a/catgets/gencat.c b/catgets/gencat.c index ee2b8cbf47..d1c92a035b 100644 --- a/catgets/gencat.c +++ b/catgets/gencat.c @@ -838,16 +838,18 @@ write_out (struct catalog *catalog, const char *output_name, #define out. But we have to take care for the set not having a symbolic name. */ if (message_run->symbol != NULL) - if (set_run->symbol == NULL) - fprintf (fp, "#define AutomaticSet%d%s %#x\t/* %s:%Zu */\n", - set_run->number, message_run->symbol, - message_run->number, message_run->fname, - message_run->line); - else - fprintf (fp, "#define %s%s %#x\t/* %s:%Zu */\n", - set_run->symbol, message_run->symbol, - message_run->number, message_run->fname, - message_run->line); + { + if (set_run->symbol == NULL) + fprintf (fp, "#define AutomaticSet%d%s %#x\t/* %s:%Zu */\n", + set_run->number, message_run->symbol, + message_run->number, message_run->fname, + message_run->line); + else + fprintf (fp, "#define %s%s %#x\t/* %s:%Zu */\n", + set_run->symbol, message_run->symbol, + message_run->number, message_run->fname, + message_run->line); + } message_run = message_run->next; } @@ -995,11 +997,13 @@ read_old (struct catalog *catalog, const char *file_name) __open_catalog (&old_cat_obj); if (old_cat_obj.status != mmapped && old_cat_obj.status != malloced) - if (errno == ENOENT) - /* No problem, the catalog simply does not exist. */ - return; - else - error (EXIT_FAILURE, errno, gettext ("while opening old catalog file")); + { + if (errno == ENOENT) + /* No problem, the catalog simply does not exist. */ + return; + else + error (EXIT_FAILURE, errno, gettext ("while opening old catalog file")); + } /* OK, we have the catalog loaded. Now read all messages and merge them. When set and message number clash for any message the new diff --git a/elf/dl-error.c b/elf/dl-error.c index cfb6b9ead5..228c1a80a1 100644 --- a/elf/dl-error.c +++ b/elf/dl-error.c @@ -33,15 +33,15 @@ struct catch }; /* Multiple threads at once can use the `_dl_catch_error' function. The - calls can come from the `_dl_map_object_deps', `_dlerror_run', or from + calls can come from `_dl_map_object_deps', `_dlerror_run', or from any of the libc functionality which loads dynamic objects (NSS, iconv). - Therefore we have to be prepared to safe the state in thread-local + Therefore we have to be prepared to save the state in thread-local memory. `catch' will only be used for the non-threaded case. Please note the horrible kludge we have to use to check for the thread functions to be defined. The problem is that while running - ld.so standalone (i.e., before the relocation with the libc symbols - available) we do not have a real handling of undefined weak symbols. + ld.so standalone (i.e., before the relocation with the available + libc symbols) we do not have a real handling of undefined weak symbols. All symbols are relocated, regardless of the availability. They are relocated relative to the load address of the dynamic linker. Adding this start address to zero (the value in the GOT for undefined symbols) diff --git a/elf/dl-load.c b/elf/dl-load.c index 35c34e0305..1082205a23 100644 --- a/elf/dl-load.c +++ b/elf/dl-load.c @@ -1100,23 +1100,25 @@ open_path (const char *name, size_t namelen, int preloaded, fd = __open (buf, O_RDONLY); if (this_dir->status[cnt] == unknown) - if (fd != -1) - this_dir->status[cnt] = existing; - else - { - /* We failed to open machine dependent library. Let's - test whether there is any directory at all. */ - struct stat st; - - buf[buflen - namelen - 1] = '\0'; - - if (__xstat (_STAT_VER, buf, &st) != 0 - || ! S_ISDIR (st.st_mode)) - /* The directory does not exist or it is no directory. */ - this_dir->status[cnt] = nonexisting; - else - this_dir->status[cnt] = existing; - } + { + if (fd != -1) + this_dir->status[cnt] = existing; + else + { + /* We failed to open machine dependent library. Let's + test whether there is any directory at all. */ + struct stat st; + + buf[buflen - namelen - 1] = '\0'; + + if (__xstat (_STAT_VER, buf, &st) != 0 + || ! S_ISDIR (st.st_mode)) + /* The directory does not exist or it is no directory. */ + this_dir->status[cnt] = nonexisting; + else + this_dir->status[cnt] = existing; + } + } if (fd != -1 && preloaded && __libc_enable_secure) { diff --git a/elf/dl-open.c b/elf/dl-open.c index 694b0ebfaa..e5509dffd4 100644 --- a/elf/dl-open.c +++ b/elf/dl-open.c @@ -127,6 +127,8 @@ dl_open_worker (void *a) new->l_global = (mode & RTLD_GLOBAL) ? 1 : 0; if (new->l_global) { + struct link_map **new_global; + /* The symbols of the new object and its dependencies are to be introduced into the global scope that will be used to resolve references from other dynamically-loaded objects. @@ -143,8 +145,6 @@ dl_open_worker (void *a) if (_dl_global_scope_alloc == 0) { /* This is the first dynamic object given global scope. */ - struct link_map **new_global; - _dl_global_scope_alloc = _dl_main_searchlist->r_nlist + 8; new_global = (struct link_map **) malloc (_dl_global_scope_alloc * sizeof (struct link_map *)); @@ -166,8 +166,6 @@ dl_open_worker (void *a) { /* We have to extend the existing array of link maps in the main map. */ - struct link_map **new_global; - new_global = (struct link_map **) malloc ((_dl_global_scope_alloc + 8) * sizeof (struct link_map *)); if (new_global == NULL) diff --git a/iconv/gconv_conf.c b/iconv/gconv_conf.c index e58091a163..4ab924a3de 100644 --- a/iconv/gconv_conf.c +++ b/iconv/gconv_conf.c @@ -291,11 +291,13 @@ add_module (char *rp, const char *directory, size_t dir_len, void **modules, memcpy (tmp - 1, gconv_module_ext, sizeof (gconv_module_ext)); if (__tfind (new_module, modules, module_compare) == NULL) - if (__tsearch (new_module, modules, module_compare) == NULL) - /* Something went wrong while inserting the new module. */ - free (new_module); - else - ++*nmodules; + { + if (__tsearch (new_module, modules, module_compare) == NULL) + /* Something went wrong while inserting the new module. */ + free (new_module); + else + ++*nmodules; + } } } diff --git a/iconv/iconv_prog.c b/iconv/iconv_prog.c index f12a69020e..7dd0f3422c 100644 --- a/iconv/iconv_prog.c +++ b/iconv/iconv_prog.c @@ -139,11 +139,13 @@ main (int argc, char *argv[]) /* Let's see whether we have these coded character sets. */ cd = iconv_open (to_code, from_code); if (cd == (iconv_t) -1) - if (errno == EINVAL) - error (EXIT_FAILURE, 0, _("conversion from `%s' to `%s' not supported"), - from_code, to_code); - else - error (EXIT_FAILURE, errno, _("failed to start conversion processing")); + { + if (errno == EINVAL) + error (EXIT_FAILURE, 0, _("conversion from `%s' to `%s' not supported"), + from_code, to_code); + else + error (EXIT_FAILURE, errno, _("failed to start conversion processing")); + } /* Determine output file. */ if (output_file != NULL) diff --git a/io/fts.c b/io/fts.c index 4c570846fa..4ce6527441 100644 --- a/io/fts.c +++ b/io/fts.c @@ -313,12 +313,13 @@ fts_read(sp) if (instr == FTS_FOLLOW && (p->fts_info == FTS_SL || p->fts_info == FTS_SLNONE)) { p->fts_info = fts_stat(sp, NULL, p, 1); - if (p->fts_info == FTS_D && !ISSET(FTS_NOCHDIR)) + if (p->fts_info == FTS_D && !ISSET(FTS_NOCHDIR)) { if ((p->fts_symfd = __open(".", O_RDONLY, 0)) < 0) { p->fts_errno = errno; p->fts_info = FTS_ERR; } else p->fts_flags |= FTS_SYMFOLLOW; + } return (p); } @@ -401,13 +402,14 @@ next: tmp = p; goto next; if (p->fts_instr == FTS_FOLLOW) { p->fts_info = fts_stat(sp, NULL, p, 1); - if (p->fts_info == FTS_D && !ISSET(FTS_NOCHDIR)) + if (p->fts_info == FTS_D && !ISSET(FTS_NOCHDIR)) { if ((p->fts_symfd = __open(".", O_RDONLY, 0)) < 0) { p->fts_errno = errno; p->fts_info = FTS_ERR; } else p->fts_flags |= FTS_SYMFOLLOW; + } p->fts_instr = FTS_NOINSTR; } @@ -641,7 +643,7 @@ fts_build(sp, type) * checking FTS_NS on the returned nodes. */ cderrno = 0; - if (nlinks || type == BREAD) + if (nlinks || type == BREAD) { if (FCHDIR(sp, dirfd(dirp))) { if (nlinks && type == BREAD) cur->fts_errno = errno; @@ -650,7 +652,7 @@ fts_build(sp, type) cderrno = errno; } else descend = 1; - else + } else descend = 0; /* diff --git a/io/ftw.c b/io/ftw.c index db687e3dbd..e012ded938 100644 --- a/io/ftw.c +++ b/io/ftw.c @@ -547,46 +547,48 @@ ftw_startup (const char *dir, int is_nftw, void *func, int descriptors, /* Get stat info for start directory. */ if (result == 0) - if (((flags & FTW_PHYS) - ? LXSTAT (_STAT_VER, data.dirbuf, &st) - : XSTAT (_STAT_VER, data.dirbuf, &st)) < 0) - { - if (errno == EACCES) - result = (*data.func) (data.dirbuf, &st, FTW_NS, &data.ftw); - else if (!(flags & FTW_PHYS) - && errno == ENOENT - && LXSTAT (_STAT_VER, dir, &st) == 0 - && S_ISLNK (st.st_mode)) - result = (*data.func) (data.dirbuf, &st, data.cvt_arr[FTW_SLN], - &data.ftw); - else - /* No need to call the callback since we cannot say anything - about the object. */ - result = -1; - } - else - { - if (S_ISDIR (st.st_mode)) - { - /* Remember the device of the initial directory in case - FTW_MOUNT is given. */ - data.dev = st.st_dev; - - /* We know this directory now. */ - if (!(flags & FTW_PHYS)) - result = add_object (&data, &st); - - if (result == 0) - result = ftw_dir (&data, &st); - } - else - { - int flag = S_ISLNK (st.st_mode) ? FTW_SL : FTW_F; - - result = (*data.func) (data.dirbuf, &st, data.cvt_arr[flag], + { + if (((flags & FTW_PHYS) + ? LXSTAT (_STAT_VER, data.dirbuf, &st) + : XSTAT (_STAT_VER, data.dirbuf, &st)) < 0) + { + if (errno == EACCES) + result = (*data.func) (data.dirbuf, &st, FTW_NS, &data.ftw); + else if (!(flags & FTW_PHYS) + && errno == ENOENT + && LXSTAT (_STAT_VER, dir, &st) == 0 + && S_ISLNK (st.st_mode)) + result = (*data.func) (data.dirbuf, &st, data.cvt_arr[FTW_SLN], &data.ftw); - } - } + else + /* No need to call the callback since we cannot say anything + about the object. */ + result = -1; + } + else + { + if (S_ISDIR (st.st_mode)) + { + /* Remember the device of the initial directory in case + FTW_MOUNT is given. */ + data.dev = st.st_dev; + + /* We know this directory now. */ + if (!(flags & FTW_PHYS)) + result = add_object (&data, &st); + + if (result == 0) + result = ftw_dir (&data, &st); + } + else + { + int flag = S_ISLNK (st.st_mode) ? FTW_SL : FTW_F; + + result = (*data.func) (data.dirbuf, &st, data.cvt_arr[flag], + &data.ftw); + } + } + } /* Return to the start directory (if necessary). */ if (cwd != NULL) diff --git a/locale/programs/stringtrans.c b/locale/programs/stringtrans.c index b810129678..873b61b5de 100644 --- a/locale/programs/stringtrans.c +++ b/locale/programs/stringtrans.c @@ -78,11 +78,8 @@ translate_string (char *str, struct charset_t *charset) tp = &str[1]; while (tp[0] != '\0' && tp[0] != '>') - if (tp[0] == '\\') - if (tp[1] != '\0') - tp += 2; - else - ++tp; + if (tp[0] == '\\' && tp[1] != '\0') + tp += 2; else ++tp; diff --git a/misc/getpass.c b/misc/getpass.c index 0187ac4957..8c6cf568a5 100644 --- a/misc/getpass.c +++ b/misc/getpass.c @@ -79,16 +79,18 @@ getpass (prompt) /* Read the password. */ nread = __getline (&buf, &bufsize, in); if (buf != NULL) - if (nread < 0) - buf[0] = '\0'; - else if (buf[nread - 1] == '\n') - { - /* Remove the newline. */ - buf[nread - 1] = '\0'; - if (tty_changed) - /* Write the newline that was not echoed. */ - putc_unlocked ('\n', out); - } + { + if (nread < 0) + buf[0] = '\0'; + else if (buf[nread - 1] == '\n') + { + /* Remove the newline. */ + buf[nread - 1] = '\0'; + if (tty_changed) + /* Write the newline that was not echoed. */ + putc_unlocked ('\n', out); + } + } /* Restore the original setting. */ if (tty_changed) diff --git a/posix/getconf.c b/posix/getconf.c index 7219c8d5a5..f0b8c910ab 100644 --- a/posix/getconf.c +++ b/posix/getconf.c @@ -662,11 +662,13 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\ usage (); value = sysconf (c->call_name); if (value == -1l) - if (c->call_name == _SC_UINT_MAX - || c->call_name == _SC_ULONG_MAX) - printf ("%lu\n", value); - else - puts (_("undefined")); + { + if (c->call_name == _SC_UINT_MAX + || c->call_name == _SC_ULONG_MAX) + printf ("%lu\n", value); + else + puts (_("undefined")); + } else printf ("%ld\n", value); exit (0); diff --git a/posix/getopt.c b/posix/getopt.c index 4d837c041a..81cef23f9b 100644 --- a/posix/getopt.c +++ b/posix/getopt.c @@ -695,16 +695,18 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only) else { if (opterr) - if (argv[optind - 1][1] == '-') - /* --option */ - fprintf (stderr, - _("%s: option `--%s' doesn't allow an argument\n"), - argv[0], pfound->name); - else - /* +option or -option */ - fprintf (stderr, - _("%s: option `%c%s' doesn't allow an argument\n"), - argv[0], argv[optind - 1][0], pfound->name); + { + if (argv[optind - 1][1] == '-') + /* --option */ + fprintf (stderr, + _("%s: option `--%s' doesn't allow an argument\n"), + argv[0], pfound->name); + else + /* +option or -option */ + fprintf (stderr, + _("%s: option `%c%s' doesn't allow an argument\n"), + argv[0], argv[optind - 1][0], pfound->name); + } nextchar += strlen (nextchar); diff --git a/posix/wordexp.c b/posix/wordexp.c index dff5d30dad..0eb0721230 100644 --- a/posix/wordexp.c +++ b/posix/wordexp.c @@ -426,6 +426,7 @@ parse_glob (char **word, size_t *word_length, size_t *max_length, /* Sort out quoting */ if (words[*offset] == '\'') + { if (quoted == 0) { quoted = 1; @@ -436,17 +437,20 @@ parse_glob (char **word, size_t *word_length, size_t *max_length, quoted = 0; continue; } + } else if (words[*offset] == '"') - if (quoted == 0) - { - quoted = 2; - continue; - } - else if (quoted == 2) - { - quoted = 0; - continue; - } + { + if (quoted == 0) + { + quoted = 2; + continue; + } + else if (quoted == 2) + { + quoted = 0; + continue; + } + } /* Sort out other special characters */ if (quoted != 1 && words[*offset] == '$') diff --git a/stdio-common/_itoa.c b/stdio-common/_itoa.c index 845928903c..e3b0533476 100644 --- a/stdio-common/_itoa.c +++ b/stdio-common/_itoa.c @@ -182,29 +182,32 @@ _itoa (value, buflim, base, upper_case) mp_limb_t work_hi = value >> (64 - BITS_PER_MP_LIMB); \ \ if (BITS_PER_MP_LIMB == 32) \ - if (work_hi != 0) \ - { \ - mp_limb_t work_lo; \ - int cnt; \ + { \ + if (work_hi != 0) \ + { \ + mp_limb_t work_lo; \ + int cnt; \ \ - work_lo = value & 0xfffffffful; \ - for (cnt = BITS_PER_MP_LIMB / BITS; cnt > 0; --cnt) \ - { \ - *--bp = digits[work_lo & ((1ul << BITS) - 1)]; \ - work_lo >>= BITS; \ - } \ - if (BITS_PER_MP_LIMB % BITS != 0) \ - { \ - work_lo |= ((work_hi \ - & ((1 << (BITS - BITS_PER_MP_LIMB%BITS)) \ - - 1)) \ - << BITS_PER_MP_LIMB % BITS); \ - *--bp = digits[work_lo]; \ - work_hi >>= BITS - BITS_PER_MP_LIMB % BITS; \ - } \ - } \ - else \ - work_hi = value & 0xfffffffful; \ + work_lo = value & 0xfffffffful; \ + for (cnt = BITS_PER_MP_LIMB / BITS; cnt > 0; --cnt) \ + { \ + *--bp = digits[work_lo & ((1ul << BITS) - 1)]; \ + work_lo >>= BITS; \ + } \ + if (BITS_PER_MP_LIMB % BITS != 0) \ + { \ + work_lo \ + |= ((work_hi \ + & ((1 << (BITS - BITS_PER_MP_LIMB%BITS)) \ + - 1)) \ + << BITS_PER_MP_LIMB % BITS); \ + *--bp = digits[work_lo]; \ + work_hi >>= BITS - BITS_PER_MP_LIMB % BITS; \ + } \ + } \ + else \ + work_hi = value & 0xfffffffful; \ + } \ do \ { \ *--bp = digits[work_hi & ((1 << BITS) - 1)]; \ diff --git a/stdio-common/printf_fp.c b/stdio-common/printf_fp.c index e54fac0a57..e5e3026bce 100644 --- a/stdio-common/printf_fp.c +++ b/stdio-common/printf_fp.c @@ -574,19 +574,21 @@ __printf_fp (FILE *fp, for overflow. This is done by comparing with 10 shifted to the right position. */ if (incr == exponent + 3) - if (cnt_h <= BITS_PER_MP_LIMB - 4) - { - topval[0] = 0; - topval[1] - = ((mp_limb_t) 10) << (BITS_PER_MP_LIMB - 4 - cnt_h); - } - else - { - topval[0] = ((mp_limb_t) 10) << (BITS_PER_MP_LIMB - 4); - topval[1] = 0; - (void) __mpn_lshift (topval, topval, 2, - BITS_PER_MP_LIMB - cnt_h); - } + { + if (cnt_h <= BITS_PER_MP_LIMB - 4) + { + topval[0] = 0; + topval[1] + = ((mp_limb_t) 10) << (BITS_PER_MP_LIMB - 4 - cnt_h); + } + else + { + topval[0] = ((mp_limb_t) 10) << (BITS_PER_MP_LIMB - 4); + topval[1] = 0; + (void) __mpn_lshift (topval, topval, 2, + BITS_PER_MP_LIMB - cnt_h); + } + } /* We have to be careful when multiplying the last factor. If the result is greater than 1.0 be have to test it @@ -816,23 +818,25 @@ __printf_fp (FILE *fp, char *tp = cp; if (digit == '5' && (*(cp - 1) & 1) == 0) - /* This is the critical case. */ - if (fracsize == 1 && frac[0] == 0) - /* Rest of the number is zero -> round to even. - (IEEE 754-1985 4.1 says this is the default rounding.) */ - goto do_expo; - else if (scalesize == 0) - { - /* Here we have to see whether all limbs are zero since no - normalization happened. */ - size_t lcnt = fracsize; - while (lcnt >= 1 && frac[lcnt - 1] == 0) - --lcnt; - if (lcnt == 0) - /* Rest of the number is zero -> round to even. - (IEEE 754-1985 4.1 says this is the default rounding.) */ - goto do_expo; - } + { + /* This is the critical case. */ + if (fracsize == 1 && frac[0] == 0) + /* Rest of the number is zero -> round to even. + (IEEE 754-1985 4.1 says this is the default rounding.) */ + goto do_expo; + else if (scalesize == 0) + { + /* Here we have to see whether all limbs are zero since no + normalization happened. */ + size_t lcnt = fracsize; + while (lcnt >= 1 && frac[lcnt - 1] == 0) + --lcnt; + if (lcnt == 0) + /* Rest of the number is zero -> round to even. + (IEEE 754-1985 4.1 says this is the default rounding.) */ + goto do_expo; + } + } if (fracdig_no > 0) { diff --git a/stdio-common/vfscanf.c b/stdio-common/vfscanf.c index 116b19b442..f9bbb6929e 100644 --- a/stdio-common/vfscanf.c +++ b/stdio-common/vfscanf.c @@ -602,11 +602,13 @@ __vfscanf (FILE *s, const char *format, va_list argptr) #define NEXT_WIDE_CHAR(First) \ c = inchar (); \ if (c == EOF) \ - /* EOF is only an error for the first character. */ \ - if (First) \ - input_error (); \ - else \ - break; \ + { \ + /* EOF is only an error for the first character. */ \ + if (First) \ + input_error (); \ + else \ + break; \ + } \ val = c; \ if (val >= 0x80) \ { \ diff --git a/stdlib/strfmon.c b/stdlib/strfmon.c index e1ff401e72..187e33fe37 100644 --- a/stdlib/strfmon.c +++ b/stdlib/strfmon.c @@ -296,18 +296,22 @@ __strfmon_l (char *s, size_t maxsize, __locale_t loc, const char *format, ...) case 'i': /* Use international currency symbol. */ currency_symbol = _NL_CURRENT (LC_MONETARY, INT_CURR_SYMBOL); if (right_prec == -1) - if (*_NL_CURRENT (LC_MONETARY, INT_FRAC_DIGITS) == CHAR_MAX) - right_prec = 2; - else - right_prec = *_NL_CURRENT (LC_MONETARY, INT_FRAC_DIGITS); + { + if (*_NL_CURRENT (LC_MONETARY, INT_FRAC_DIGITS) == CHAR_MAX) + right_prec = 2; + else + right_prec = *_NL_CURRENT (LC_MONETARY, INT_FRAC_DIGITS); + } break; case 'n': /* Use national currency symbol. */ currency_symbol = _NL_CURRENT (LC_MONETARY, CURRENCY_SYMBOL); if (right_prec == -1) - if (*_NL_CURRENT (LC_MONETARY, FRAC_DIGITS) == CHAR_MAX) - right_prec = 2; - else - right_prec = *_NL_CURRENT (LC_MONETARY, FRAC_DIGITS); + { + if (*_NL_CURRENT (LC_MONETARY, FRAC_DIGITS) == CHAR_MAX) + right_prec = 2; + else + right_prec = *_NL_CURRENT (LC_MONETARY, FRAC_DIGITS); + } break; default: /* Any unrecognized format is an error. */ __set_errno (EINVAL); @@ -493,24 +497,26 @@ __strfmon_l (char *s, size_t maxsize, __locale_t loc, const char *format, ...) /* Now test whether the output width is filled. */ if (dest - startp < width) - if (left) - /* We simply have to fill using spaces. */ - do - out_char (' '); - while (dest - startp < width); - else - { - int dist = width - (dest - startp); - char *cp; - for (cp = dest - 1; cp >= startp; --cp) - cp[dist] = cp[0]; + { + if (left) + /* We simply have to fill using spaces. */ + do + out_char (' '); + while (dest - startp < width); + else + { + int dist = width - (dest - startp); + char *cp; + for (cp = dest - 1; cp >= startp; --cp) + cp[dist] = cp[0]; - dest += dist; + dest += dist; - do - startp[--dist] = ' '; - while (dist > 0); - } + do + startp[--dist] = ' '; + while (dist > 0); + } + } } /* Terminate the string. */ diff --git a/string/strcoll.c b/string/strcoll.c index 08ffd63563..f44f6c1f6d 100644 --- a/string/strcoll.c +++ b/string/strcoll.c @@ -117,8 +117,9 @@ STRCOLL (s1, s2, l) == (uint32_t) IGNORE_CHAR)) { ++s1ignore; - if ((forward && ++s1idx >= s1run->data[pass].number) - || (!forward && --s1idx < 0)) + if (forward + ? ++s1idx >= s1run->data[pass].number + : --s1idx < 0) { weight_t *nextp = forward ? s1run->next : s1run->prev; if (nextp == NULL) @@ -139,8 +140,9 @@ STRCOLL (s1, s2, l) == (uint32_t) IGNORE_CHAR)) { ++s2ignore; - if ((forward && ++s2idx >= s2run->data[pass].number) - || (!forward && --s2idx < 0)) + if (forward + ? ++s2idx >= s2run->data[pass].number + : --s2idx < 0) { weight_t *nextp = forward ? s2run->next : s2run->prev; if (nextp == NULL) diff --git a/string/strxfrm.c b/string/strxfrm.c index b3e99fb094..0bdf1069b6 100644 --- a/string/strxfrm.c +++ b/string/strxfrm.c @@ -217,8 +217,9 @@ STRXFRM (STRING_TYPE *dest, const STRING_TYPE *src, size_t n, __locale_t l) == (u_int32_t) IGNORE_CHAR)) { ++ignore; - if ((forward && ++idx >= run->data[pass].number) - || (!forward && --idx < 0)) + if (forward + ? ++idx >= run->data[pass].number + : --idx < 0) { weight_t *nextp = forward ? run->next : run->prev; if (nextp == NULL) diff --git a/sysdeps/generic/glob.c b/sysdeps/generic/glob.c index c41d03f8b2..e50963e9c4 100644 --- a/sysdeps/generic/glob.c +++ b/sysdeps/generic/glob.c @@ -659,10 +659,12 @@ glob (pattern, flags, errfunc, pglob) } } if (home_dir == NULL || home_dir[0] == '\0') - if (flags & GLOB_TILDE_CHECK) - return GLOB_NOMATCH; - else - home_dir = "~"; /* No luck. */ + { + if (flags & GLOB_TILDE_CHECK) + return GLOB_NOMATCH; + else + home_dir = "~"; /* No luck. */ + } # endif /* WINDOWS32 */ # endif /* Now construct the full directory. */ @@ -882,78 +884,80 @@ glob (pattern, flags, errfunc, pglob) flag was set we must return the list consisting of the disrectory names followed by the filename. */ if (pglob->gl_pathc == oldcount) - /* No matches. */ - if (flags & GLOB_NOCHECK) - { - size_t filename_len = strlen (filename) + 1; - char **new_pathv; - struct stat st; - - /* This is an pessimistic guess about the size. */ - pglob->gl_pathv - = (char **) realloc (pglob->gl_pathv, - (pglob->gl_pathc + - ((flags & GLOB_DOOFFS) ? - pglob->gl_offs : 0) + - dirs.gl_pathc + 1) * - sizeof (char *)); - if (pglob->gl_pathv == NULL) - { - globfree (&dirs); - return GLOB_NOSPACE; - } + { + /* No matches. */ + if (flags & GLOB_NOCHECK) + { + size_t filename_len = strlen (filename) + 1; + char **new_pathv; + struct stat st; + + /* This is an pessimistic guess about the size. */ + pglob->gl_pathv + = (char **) realloc (pglob->gl_pathv, + (pglob->gl_pathc + + ((flags & GLOB_DOOFFS) ? + pglob->gl_offs : 0) + + dirs.gl_pathc + 1) * + sizeof (char *)); + if (pglob->gl_pathv == NULL) + { + globfree (&dirs); + return GLOB_NOSPACE; + } - if (flags & GLOB_DOOFFS) - while (pglob->gl_pathc < pglob->gl_offs) - pglob->gl_pathv[pglob->gl_pathc++] = NULL; + if (flags & GLOB_DOOFFS) + while (pglob->gl_pathc < pglob->gl_offs) + pglob->gl_pathv[pglob->gl_pathc++] = NULL; - for (i = 0; i < dirs.gl_pathc; ++i) - { - const char *dir = dirs.gl_pathv[i]; - size_t dir_len = strlen (dir); - - /* First check whether this really is a directory. */ - if (((flags & GLOB_ALTDIRFUNC) - ? (*pglob->gl_stat) (dir, &st) : __stat (dir, &st)) != 0 - || !S_ISDIR (st.st_mode)) - /* No directory, ignore this entry. */ - continue; - - pglob->gl_pathv[pglob->gl_pathc] = malloc (dir_len + 1 - + filename_len); - if (pglob->gl_pathv[pglob->gl_pathc] == NULL) - { - globfree (&dirs); - globfree (pglob); - return GLOB_NOSPACE; - } + for (i = 0; i < dirs.gl_pathc; ++i) + { + const char *dir = dirs.gl_pathv[i]; + size_t dir_len = strlen (dir); + + /* First check whether this really is a directory. */ + if (((flags & GLOB_ALTDIRFUNC) + ? (*pglob->gl_stat) (dir, &st) : __stat (dir, &st)) != 0 + || !S_ISDIR (st.st_mode)) + /* No directory, ignore this entry. */ + continue; + + pglob->gl_pathv[pglob->gl_pathc] = malloc (dir_len + 1 + + filename_len); + if (pglob->gl_pathv[pglob->gl_pathc] == NULL) + { + globfree (&dirs); + globfree (pglob); + return GLOB_NOSPACE; + } #ifdef HAVE_MEMPCPY - mempcpy (mempcpy (mempcpy (pglob->gl_pathv[pglob->gl_pathc], - dir, dir_len), - "/", 1), - filename, filename_len); + mempcpy (mempcpy (mempcpy (pglob->gl_pathv[pglob->gl_pathc], + dir, dir_len), + "/", 1), + filename, filename_len); #else - memcpy (pglob->gl_pathv[pglob->gl_pathc], dir, dir_len); - pglob->gl_pathv[pglob->gl_pathc][dir_len] = '/'; - memcpy (&pglob->gl_pathv[pglob->gl_pathc][dir_len + 1], - filename, filename_len); + memcpy (pglob->gl_pathv[pglob->gl_pathc], dir, dir_len); + pglob->gl_pathv[pglob->gl_pathc][dir_len] = '/'; + memcpy (&pglob->gl_pathv[pglob->gl_pathc][dir_len + 1], + filename, filename_len); #endif - ++pglob->gl_pathc; - } + ++pglob->gl_pathc; + } - pglob->gl_pathv[pglob->gl_pathc] = NULL; - pglob->gl_flags = flags; + pglob->gl_pathv[pglob->gl_pathc] = NULL; + pglob->gl_flags = flags; - /* Now we know how large the gl_pathv vector must be. */ - new_pathv = (char **) realloc (pglob->gl_pathv, - ((pglob->gl_pathc + 1) - * sizeof (char *))); - if (new_pathv != NULL) - pglob->gl_pathv = new_pathv; - } - else - return GLOB_NOMATCH; + /* Now we know how large the gl_pathv vector must be. */ + new_pathv = (char **) realloc (pglob->gl_pathv, + ((pglob->gl_pathc + 1) + * sizeof (char *))); + if (new_pathv != NULL) + pglob->gl_pathv = new_pathv; + } + else + return GLOB_NOMATCH; + } globfree (&dirs); } @@ -1352,10 +1356,12 @@ glob_in_dir (pattern, directory, flags, errfunc, pglob) save = errno; if (stream != NULL) - if (flags & GLOB_ALTDIRFUNC) - (*pglob->gl_closedir) (stream); - else - closedir ((DIR *) stream); + { + if (flags & GLOB_ALTDIRFUNC) + (*pglob->gl_closedir) (stream); + else + closedir ((DIR *) stream); + } __set_errno (save); return nfound == 0 ? GLOB_NOMATCH : 0; diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c index 30cc6364e7..7502e00e6a 100644 --- a/sysdeps/posix/getaddrinfo.c +++ b/sysdeps/posix/getaddrinfo.c @@ -283,10 +283,12 @@ gaih_inet (const char *name, const struct gaih_service *service, ((req->ai_socktype != tp->socktype) || !req->ai_socktype) && ((req->ai_protocol != tp->protocol) || !req->ai_protocol); tp++); if (tp->name == NULL) - if (req->ai_socktype) - return (GAIH_OKIFUNSPEC | -EAI_SOCKTYPE); - else - return (GAIH_OKIFUNSPEC | -EAI_SERVICE); + { + if (req->ai_socktype) + return (GAIH_OKIFUNSPEC | -EAI_SOCKTYPE); + else + return (GAIH_OKIFUNSPEC | -EAI_SERVICE); + } } if (service != NULL) diff --git a/sysdeps/powerpc/dl-machine.h b/sysdeps/powerpc/dl-machine.h index bb449a9d34..ce6fcd02ab 100644 --- a/sysdeps/powerpc/dl-machine.h +++ b/sysdeps/powerpc/dl-machine.h @@ -278,7 +278,7 @@ extern void __process_machine_rela (struct link_map *map, LOADADDR is the load address of the object; INFO is an array indexed by DT_* of the .dynamic section info. */ -extern void +inline void elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc, const Elf32_Sym *sym, const struct r_found_version *version, Elf32_Addr *const reloc_addr) diff --git a/time/mktime.c b/time/mktime.c index f5a4f61f67..ce691c8451 100644 --- a/time/mktime.c +++ b/time/mktime.c @@ -26,8 +26,8 @@ #endif /* Some systems need this in order to declare localtime_r properly. */ -#ifndef _REENTRANT -# define _REENTRANT 1 +#ifndef __EXTENSIONS__ +# define __EXTENSIONS__ 1 #endif #ifdef _LIBC diff --git a/time/strftime.c b/time/strftime.c index ed029605d9..f724bf3e3b 100644 --- a/time/strftime.c +++ b/time/strftime.c @@ -21,8 +21,8 @@ #endif /* Some hosts need this in order to declare localtime_r properly. */ -#ifndef _REENTRANT -# define _REENTRANT 1 +#ifndef __EXTENSIONS__ +# define __EXTENSIONS__ 1 #endif #ifdef _LIBC @@ -547,7 +547,7 @@ my_strftime (s, maxsize, format, tp) len += strlen (f + len); break; } - + if (bytes == (size_t) -1) { len++; diff --git a/wcsmbs/wcstok.c b/wcsmbs/wcstok.c index 1e8c95fe7f..5ce6061e93 100644 --- a/wcsmbs/wcstok.c +++ b/wcsmbs/wcstok.c @@ -32,13 +32,15 @@ wcstok (wcs, delim, save_ptr) wchar_t *result; if (wcs == NULL) - if (*save_ptr == NULL) - { - __set_errno (EINVAL); - return NULL; - } - else - wcs = *save_ptr; + { + if (*save_ptr == NULL) + { + __set_errno (EINVAL); + return NULL; + } + else + wcs = *save_ptr; + } /* Scan leading delimiters. */ wcs += wcsspn (wcs, delim); |