summaryrefslogtreecommitdiffstats
path: root/libidu
Commit message (Collapse)AuthorAgeFilesLines
* lid: avoid reading beyond end of buffer for a long nameJim Meyering2012-10-232-5/+16
| | | | | | | | | | | * libidu/idfile.h (stzncpy): Define, from coreutils. * src/lid.c (query_ambiguous_prefix): Avoid buffer overrun. Using strncpy to copy a too-long name would result in a "name" that is not NUL-terminated, yet that name would be treated as a NUL-terminated string immediately afterwards, via report_func, which attempts to print it. * libidu/fnprint.c (root_name): Use stzncpy in place of strncpy. * NEWS (Bug fixes): Mention the bug fix.
* build: add const and pure attributes, per gcc recommendationJim Meyering2012-01-314-23/+25
| | | | | | | | | | | | | | | | | | | | | | | | * src/mkid.c (ceil_log_8, ceil_log_2): Add "const" attribute. (token_hash_1, token_hash_2): Add "pure" attribute. (token_hash_cmp, token_qsort_cmp): Likewise. (count_vec_size, count_buf_size): Likewise. * libidu/idu-hash.c (round_up_2): Add "const" attribute. * libidu/scanners.h (get_language): Add "pure" attribute. * libidu/idfile.h (token_flags): Likewise. (token_count): Likewise. (member_file_qsort_compare): Likewise. (tree8_count_levels): Add "const" attribute. * libidu/walker.c (symlink_ancestry): Add "pure" attribute. (links_depth): Likewise. (file_link_hash_1): Likewise. (vector_length): Likewise. (file_link_hash_compare): Likewise. (string_in_vector): Likewise. * src/lid.c (vector_cardinality, get_radix, dtoi, otoi): Likewise. (is_regexp): Likewise. (vector_length): Remove forward decl and move function definition to precede first use.
* maint: avoid new syntax-check failure due to #if HAVE_SYS_TYPES_HJim Meyering2012-01-011-3/+1
| | | | | | * libidu/idfile.h: Include <sys/types.h> unconditionally. I.e., drop the now-redundant #if HAVE_SYS_TYPES_H guard. gnulib guarantees the presence of that header.
* maint: update all copyright year number rangesJim Meyering2012-01-0115-15/+15
| | | | Run "make update-copyright".
* maint: remove unused inclusion of <stddef.h>Jim Meyering2011-03-202-2/+0
| | | | | | * libidu/scanners.c: As above. * libidu/walker.c: Likewise. * src/mkid.c: Likewise.
* maint: update copyright year ranges to include 2011Jim Meyering2011-03-2015-15/+15
| | | | Run "make update-copyright".
* mkid, xtokid: fixed conflict checking between include/exclude lang options.Pedro J. Ruiz Lopez2010-11-111-1/+1
| | | | * libidu/walker.c: fixed condition.
* mkid: handle the .xz suffixJim Meyering2010-06-171-1/+2
| | | | | * libidu/id-lang.map: Teach mkid about the .xz suffix. Tell mkid to use the "xz" program on .lzma files.
* build: remove now-unnecessary replacement lstat definitionJim Meyering2010-06-161-8/+0
| | | | | * libidu/walker.c [! HAVE_LSTAT] (lstat): Remove definition. Gnulib already handles that.
* build: avoid new syntax-check failureJim Meyering2010-05-091-4/+0
| | | | | * libidu/iduglobal.h (FNM_FILE_NAME): Remove definition. Now, it's provided by gnulib.
* maint: accommodate new syntax-check rulesJim Meyering2010-05-011-3/+1
| | | | | | | * bootstrap.conf (gnulib_modules): Add sys_ioctl * src/lid.c: Include <sys/ioctl.h> unconditionally. * libidu/xnls.h: Don't depend on HAVE_LOCALE_H. <locale.h> is always available.
* maint: remove all .cvsignore filesJim Meyering2010-01-011-2/+0
|
* maint: update all FSF copyright year lists to include 2010Jim Meyering2010-01-0115-18/+21
| | | | | | Use this command: git ls-files |grep -vE '^(\..*|COPYING|gnulib)$' |xargs \ env UPDATE_COPYRIGHT_USE_INTERVALS=1 build-aux/update-copyright
* build: accommodate new syntax-check testJim Meyering2009-10-305-16/+16
| | | | | | | | | | | | | | | | | | | | | | | | Use EXIT_FAILURE and EXIT_SUCCESS, not 1 and 0. Apply these commands: perl -pi -e 's/\berror \(1,/error (EXIT_FAILURE,/' \ $(git grep -l '\<error (1,') perl -pi -e 's/\bexit \(1\)/exit (EXIT_FAILURE)/' \ $(git grep -l '\<exit (1)') perl -pi -e 's/\bexit \(0\)/exit (EXIT_SUCCESS)/' \ $(git grep -l '\<exit (0)') * libidu/idread.c (read_id_file, maybe_read_id_file, io_read): * libidu/idu-hash.c (hash_init): * libidu/idwrite.c (io_write): * libidu/scanners.c (parse_language_map, parse_language_map_file): (read_language_map_file): * libidu/walker.c (include_languages, exclude_languages): (get_current_dir_link): * src/fid.c (usage, help_me, main): * src/fnid.c (usage, help_me, main): * src/lid.c (usage, help_me, main, report_grep, report_edit): (query_regexp): * src/mkid.c (main, assert_writeable, write_id_file): * src/xtokid.c (help_me):
* maint: declare usage with "noreturn" attribute, so...Jim Meyering2009-08-311-1/+1
| | | | * libidu/scanners.c: ...tools like llvm understand flow control better.
* maint: use better syntax: NULL, not 0, in pointer comparisonJim Meyering2009-08-311-1/+1
| | | | * libidu/scanners.c (language_save_arg): Compare pointer to NULL, not 0.
* maint: update copyright year lists to include 2009Jim Meyering2009-08-1512-15/+15
|
* rename hash.? to idu-hash.? to avoid conflict with gnulib's hash.hJim Meyering2009-08-156-7/+7
| | | | | | | | | | | | | Now that gnulib's exclude module uses gnulib's hash module, which includes a hash.h file, idutils' use of a hash.h file conflicted. Rename the one here in idutils: * libidu/idu-hash.c: Rename from hash.c. * libidu/idu-hash.h: Rename from hash.h. * libidu/idfile.h: Reflect renaming. * libidu/idread.c: Likewise. * libidu/idwrite.c: Likewise. * src/mkid.c: Likewise. * libidu/Makefile.am: Likewise.
* build: avoid a legitimate warning exposed by newer gccJim Meyering2009-08-151-1/+0
| | | | | * libidu/scanners.c (language_save_arg): Remove decl of unused static local, horizontal_space.
* mkid: avoid segfault with "-l OPT"Pedro J. Ruiz Lopez2009-08-131-2/+2
| | | | | | | | | * libidu/scanners.c: languages_0[] is not const anymore, since this would make impossible to set lang->lg_argv * libidu/scanners.c: language_save_arg now manages language options with zero or one argument. * doc/idutils.texi: update to reflect the behavior of mkid "-l" option. * testsuite/mkid-langopt: new test program.
* mkid, xtokid: read and process --files0-from= input a name at a time,Jim Meyering2009-07-041-1/+9
| | | | | | | | | | | | rather than by reading the entire input into memory and *then* processing each file name. * src/mkid.c: Include "argv-iter.h", not "readtokens0.h". (main): Rewrite to use argv-iter. * src/xtokid.c: Likewise. Include <assert.h>. * bootstrap.conf (gnulib_modules): Add argv-iter. Remove readtokens0. * libidu/iduglobal.h (STREQ): Define. (bad_cast): Define.
* Fixed bug #22154: --default-lang does nothingPedro J. Ruiz Lopez2009-06-161-0/+16
| | | | * libidu/scanners.c: set_default_language function implemented.
* maint: add const attribute to a few declarationsJim Meyering2009-06-072-6/+6
| | | | | | * libidu/hash.c (hash_print_stats, hash_dump): Add const. * libidu/hash.h: Likewise. * src/mkid.c (scan_files): Likewise.
* avoid a legitimate -Wstrict-overflow warningJim Meyering2009-04-302-3/+3
| | | | | * libidu/scanners.h (log_8_member_files): Change type from int to size_t. * libidu/scanners.c: Likewise.
* build: suppress warnings about ignored return value from fread/fwriteJim Meyering2009-04-302-5/+9
| | | | | | | * libidu/idwrite.c: include "ignore-value.h". (io_write): Ignore fwrite return value. * libidu/idread.c: Likewise for fread. * bootstrap.conf (gnulib_modules): Add ignore-value.
* build: remove unused macrosJim Meyering2009-04-301-5/+1
| | | | * libidu/scanners.c (ISSPACE, WS): Remove unused macros.
* build: avoid a warningJim Meyering2009-04-301-2/+2
| | | | * libidu/idfile.c (sizeof_idhead): Avoid old-style function definition.
* build: remove unused macrosJim Meyering2009-04-301-4/+1
| | | | | * libidu/idread.c (TOK_COUNT_ADDR): Remove unused macro. (TOK_HITS_ADDR): Likewise.
* build: enable new compiler warning optionsJim Meyering2009-04-301-1/+2
| | | | | | | * src/Makefile.am (AM_CFLAGS): Define to $(WARN_CFLAGS) $(WERROR_CFLAGS). * libidu/Makefile.am (AM_CPPFLAGS): Remove bogus -I$(top_builddir)/intl (AM_CFLAGS): Define to $(WARN_CFLAGS) $(WERROR_CFLAGS). * src/Makefile.am (AM_CPPFLAGS): Remove bogus -I.../intl
* recognize `.org' files as textLudovic Courtès2009-03-021-0/+1
| | | | * libidu/id-lang.map: Add `.org' extension, for Emacs Org-Mode files.
* recognize a few more file typesJim Meyering2008-10-261-0/+6
| | | | | * libidu/id-lang.map: Recognize .rb, .in.h, .PL, configure.in, and GNUmakefile.
* avoid a start-up leakJim Meyering2008-10-261-10/+4
| | | | * libidu/walker.c (get_current_dir_link): Don't leak cwd_0.
* accommodate gnulib header removalsPedro J. Ruiz Lopez2008-10-223-3/+3
| | | | | | | * libidu/idfile.c: Include <sys/stat.h>, not "lstat.h". * libidu/scanners.c: Likewise. * libidu/walker.c: Likewise. * src/mkid.c: Likewise.
* avoid warnings, adjust for const-correctnessJim Meyering2008-06-241-4/+4
| | | | | | | | | | | | | | * libidu/scanners.c (long_options_c, long_options_asm) (long_options_text, long_options_perl): Add initializers. * src/fid.c (long_options): Add initializers. * src/fnid.c (long_options): Add initializers. * src/lid.c (ATTRIBUTE_UNUSED): Define. (long_options): Add initializers. (report_nothing): Mark parameter as unused. (get_editor_argv, report_edit): Adjust for const-correctness. * src/mkid.c (long_options): Add initializers. (report_statistics): Don't subtract "void*" pointers. Cast to "char*". * src/xtokid.c (long_options): Add initializers.
* remove redundant "const" in declarationsJim Meyering2008-06-241-5/+5
| | | | | | | | | | * libidu/scanners.c (languages_0, long_options_c): Likewise. (long_options_asm, long_options_text, long_options_perl): Likewise. * src/fid.c (long_options): Likewise. * src/fnid.c (long_options): Likewise. * src/lid.c (long_options): Likewise. * src/mkid.c (long_options): Likewise. * src/xtokid.c (long_options): Likewise.
* sync maint.mk from coreutils, and adjust to conformJim Meyering2008-06-141-4/+4
| | | | | | | | * libidu/scanners.c (long_options_c, long_options_asm): Add "const". (long_options_text, long_options_perl): Likewise. * src/fnid.c (long_options): Likewise. * src/lid.c (long_options): Likewise. * src/xtokid.c (long_options): Likewise.
* recognize more suffixes: .mk, .ac, .bz2, .lzma.Jim Meyering2008-05-191-1/+5
| | | | | | * libidu/id-lang.map: Add .mk -> make, .ac -> m4. Handle .bz2 and .lzma, too. * NEWS: Mention this. Add a few more news items.
* tighten scope in libidu/, tooJim Meyering2008-05-176-41/+43
| | | | | | | | | | | | | | | | | | Mark with "extern" the symbols that belong that way. Make the others static. * libidu/dynvec.h (dv_fill): * libidu/fnprint.c (cw_dlink): * libidu/hash.h (qsort_cmp_t): * libidu/idfile.h (io_func_t): * libidu/scanners.c (lang_args_obstack, languages_0, languages_N): (language_help_me, language_getopt, get_language): (lang_args_index): * libidu/walker.c (largest_member_file): * maint.mk (extract_char, today): * src/fid.c (long_options): * src/fnid.c (cw_dlink): * src/lid.c (cw_dlink): * src/xtokid.c (cw_dlink):
* make more functions staticJim Meyering2008-05-176-82/+98
|
* Remove unnecessary test before "free".Jim Meyering2008-01-301-2/+1
| | | | | * libidu/walker.c (get_current_dir_link): Remove "if (xcwd)" just before "free (xcwd);".
* Remove trailing blanks.Jim Meyering2008-01-301-15/+15
| | | | | | | | | | | | * README-alpha: * TODO: * doc/idutils.texi: * libidu/scanners.c (set_uchar_ctype, ARGS, get_token_lisp): * src/Makefile.am: * src/fid.c (main): * src/lid.c (report_edit): * Makefile.cfg (local-checks-to-skip): Remove sc_trailing_blank, thus enabling that check.
* Remove useless multiply-by-1. Avoid sizeof TYPE: use equivalent sizeof *VAR.Jim Meyering2008-01-302-5/+5
| | | | | | * libidu/dynvec.c (make_dynvec): * libidu/scanners.c (parse_language_map_file, parse_args_c) (parse_args_asm, parse_args_text):
* Allocate safely.Jim Meyering2008-01-303-9/+10
| | | | | | | | * libidu/dynvec.c (make_dynvec, dynvec_freeze, dynvec_append): Use xnmalloc, not xmalloc (n * sizeof T). Use xnrealloc, not xrealloc (p, n * sizeof T). * libidu/walker.c (append_strings_to_vector, vectorize_string): Likewise. * libidu/scanners.c (tokenize_args_string): Likewise.
* Use xstrdup, not strdup.Jim Meyering2008-01-304-10/+11
| | | | | | | | | * src/lid.c (get_editor_argv): Use xstrdup, not strdup. * libidu/walker.c (get_current_dir_link): Likewise. * libidu/idfile.c: Include "xalloc.h". (locate_id_file_name): Handle failed strdup. * libidu/scanners.c (parse_args_text, parse_args_perl): Likewise. (parse_args_c, parse_args_asm): Likewise.
* fid: avoid buffer overrun.Jim Meyering2008-01-141-2/+2
| | | | | | | | | | | | | | | | | | | | | | * libidu/idread.c (deserialize_file_links): Fix typo (or think-o). Here's what valgrind reported: Invalid write of size 4 at 0x804A15A: deserialize_file_links (idread.c:132) by 0x8049DEE: maybe_read_id_file (idread.c:74) by 0x8049C64: read_id_file (idread.c:46) by 0x80492FB: main (fid.c:170) Address 0x41EB944 is 628 bytes inside a block of size 629 alloc'd at 0x4022765: malloc (vg_replace_malloc.c:149) by 0x80516BC: xnmalloc_inline (xmalloc.c:49) by 0x80516EE: xmalloc (xmalloc.c:65) by 0x8049E2F: deserialize_file_links (idread.c:87) by 0x8049DEE: maybe_read_id_file (idread.c:74) by 0x8049C64: read_id_file (idread.c:46) by 0x80492FB: main (fid.c:170) Signed-off-by: Jim Meyering <meyering@redhat.com>
* Convert to coreutils-flavored gnulib.Jim Meyering2008-01-141-1/+0
| | | | Signed-off-by: Jim Meyering <meyering@redhat.com>
* Mark diagnostics for translation.Jim Meyering2008-01-141-2/+2
| | | | | | | | * src/mkid.c (main): Mark with _(...). * libidu/walker.c (exclude_languages, include_languages): Likewise. * src/lid.c (report_grep): Likewise. Signed-off-by: Jim Meyering <meyering@redhat.com>
* Don't cast x*alloc return value.Jim Meyering2008-01-141-3/+3
| | | | | | | * libidu/hash.c (hash_rehash): Remove cast. (hash_init): Likewise. Signed-off-by: Jim Meyering <meyering@redhat.com>
* Don't include <strsep.h>. Now it's guaranteed to be in <string.h>.Jim Meyering2008-01-043-6/+3
| | | | | | | | * libidu/walker.c: Don't include <strsep.h>. * libidu/idfile.c: Likewise. * libidu/scanners.c: Likewise. Signed-off-by: Jim Meyering <meyering@redhat.com>
* License upgrade to "GPL-3 or later"Pedro J. Ruiz Lopez2007-08-1715-61/+52
|