diff options
author | Chet Ramey <chet@caleb.ins.cwru.edu> | 2012-01-09 08:43:24 -0500 |
---|---|---|
committer | Chet Ramey <chet@caleb.ins.cwru.edu> | 2012-01-09 08:43:24 -0500 |
commit | d00a2d66927ffec865bb63a39f7ad7fa98e0fe9b (patch) | |
tree | 220ca785362d8a4d01aca87ddf2883115a530294 | |
parent | 118331012f573644d3c10484cc0ed051f59c8e31 (diff) | |
download | bash-d00a2d66927ffec865bb63a39f7ad7fa98e0fe9b.tar.gz |
bash-20111229 more cleanup
-rw-r--r-- | ddd1 | 216 | ||||
-rw-r--r-- | lib/glob/ddd1 | 107 |
2 files changed, 0 insertions, 323 deletions
@@ -1,216 +0,0 @@ -*** ../bash-20111118/lib/readline/complete.c 2011-10-02 14:18:22.000000000 -0400 ---- lib/readline/complete.c 2011-11-26 16:01:20.000000000 -0500 -*************** -*** 31,36 **** ---- 31,38 ---- - # include <sys/file.h> - #endif - -+ #include <signal.h> -+ - #if defined (HAVE_UNISTD_H) - # include <unistd.h> - #endif /* HAVE_UNISTD_H */ -*************** -*** 105,110 **** ---- 107,114 ---- - - static char *rl_quote_filename PARAMS((char *, int, char *)); - -+ static void _rl_complete_sigcleanup PARAMS((int, void *)); -+ - static void set_completion_defaults PARAMS((int)); - static int get_y_or_n PARAMS((int)); - static int _rl_internal_pager PARAMS((int)); -*************** -*** 459,464 **** ---- 463,477 ---- - rl_completion_quote_character = 0; - } - -+ static void -+ _rl_complete_sigcleanup (sig, ptr) -+ int sig; -+ void *ptr; -+ { -+ if (sig == SIGINT) /* XXX - for now */ -+ _rl_free_match_list ((char **)ptr); -+ } -+ - /* Set default values for readline word completion. These are the variables - that application completion functions can change or inspect. */ - static void -*************** -*** 1060,1073 **** - variable rl_attempted_completion_function. */ - if (rl_attempted_completion_function) - { -- #if 0 -- _rl_interrupt_immediately++; -- #endif - matches = (*rl_attempted_completion_function) (text, start, end); -! #if 0 -! if (_rl_interrupt_immediately > 0) -! _rl_interrupt_immediately--; -! #endif - - if (matches || rl_attempted_completion_over) - { ---- 1073,1085 ---- - variable rl_attempted_completion_function. */ - if (rl_attempted_completion_function) - { - matches = (*rl_attempted_completion_function) (text, start, end); -! if (RL_SIG_RECEIVED()) -! { -! _rl_free_match_list (matches); -! matches = 0; -! RL_CHECK_SIGNALS (); -! } - - if (matches || rl_attempted_completion_over) - { -*************** -*** 1078,1084 **** ---- 1090,1104 ---- - - /* XXX -- filename dequoting moved into rl_filename_completion_function */ - -+ /* rl_completion_matches will check for signals as well to avoid a long -+ delay while reading a directory. */ - matches = rl_completion_matches (text, our_func); -+ if (RL_SIG_RECEIVED()) -+ { -+ _rl_free_match_list (matches); -+ matches = 0; -+ RL_CHECK_SIGNALS (); -+ } - return matches; - } - -*************** -*** 1838,1847 **** - /* nontrivial_lcd is set if the common prefix adds something to the word - being completed. */ - nontrivial_lcd = matches && strcmp (text, matches[0]) != 0; -- #if 1 - if (what_to_do == '!' || what_to_do == '@') - tlen = strlen (text); -- #endif - xfree (text); - - if (matches == 0) ---- 1858,1865 ---- -*************** -*** 1875,1884 **** - case '!': - case '@': - /* Insert the first match with proper quoting. */ -- #if 0 -- if (*matches[0]) -- insert_match (matches[0], start, matches[1] ? MULT_MATCH : SINGLE_MATCH, "e_char); -- #else - if (what_to_do == TAB) - { - if (*matches[0]) ---- 1893,1898 ---- -*************** -*** 1893,1899 **** - if (mlen >= tlen) - insert_match (matches[0], start, matches[1] ? MULT_MATCH : SINGLE_MATCH, "e_char); - } -- #endif - - /* If there are more matches, ring the bell to indicate. - If we are in vi mode, Posix.2 says to not ring the bell. ---- 1907,1912 ---- -*************** -*** 1929,1935 **** ---- 1942,1955 ---- - break; - - case '?': -+ if (rl_completion_display_matches_hook == 0) -+ { -+ _rl_sigcleanup = _rl_complete_sigcleanup; -+ _rl_sigcleanarg = matches; -+ } - display_matches (matches); -+ _rl_sigcleanup = 0; -+ _rl_sigcleanarg = 0; - break; - - default: -*************** -*** 1937,1942 **** ---- 1957,1963 ---- - rl_ding (); - FREE (saved_line_buffer); - RL_UNSETSTATE(RL_STATE_COMPLETING); -+ _rl_free_match_list (matches); - _rl_reset_completion_state (); - return 1; - } -*************** -*** 1978,1983 **** ---- 1999,2006 ---- - const char *text; - rl_compentry_func_t *entry_function; - { -+ register int i; -+ - /* Number of slots in match_list. */ - int match_list_size; - -*************** -*** 1995,2005 **** - match_list = (char **)xmalloc ((match_list_size + 1) * sizeof (char *)); - match_list[1] = (char *)NULL; - -- #if 0 -- _rl_interrupt_immediately++; -- #endif - while (string = (*entry_function) (text, matches)) - { - if (matches + 1 == match_list_size) - match_list = (char **)xrealloc - (match_list, ((match_list_size += 10) + 1) * sizeof (char *)); ---- 2018,2042 ---- - match_list = (char **)xmalloc ((match_list_size + 1) * sizeof (char *)); - match_list[1] = (char *)NULL; - - while (string = (*entry_function) (text, matches)) - { -+ if (RL_SIG_RECEIVED ()) -+ { -+ /* Start at 1 because we don't set matches[0] in this function. -+ Only free the list members if we're building match list from -+ rl_filename_completion_function, since we know that doesn't -+ free the strings it returns. */ -+ if (entry_function == rl_filename_completion_function) -+ { -+ for (i = 1; match_list[i]; i++) -+ xfree (match_list[i]); -+ } -+ xfree (match_list); -+ match_list = 0; -+ match_list_size = 0; -+ RL_CHECK_SIGNALS (); -+ } -+ - if (matches + 1 == match_list_size) - match_list = (char **)xrealloc - (match_list, ((match_list_size += 10) + 1) * sizeof (char *)); -*************** -*** 2007,2016 **** - match_list[++matches] = string; - match_list[matches + 1] = (char *)NULL; - } -- #if 0 -- if (_rl_interrupt_immediately > 0) -- _rl_interrupt_immediately--; -- #endif - - /* If there were any matches, then look through them finding out the - lowest common denominator. That then becomes match_list[0]. */ ---- 2044,2049 ---- diff --git a/lib/glob/ddd1 b/lib/glob/ddd1 deleted file mode 100644 index 1e694310..00000000 --- a/lib/glob/ddd1 +++ /dev/null @@ -1,107 +0,0 @@ -*** /fs2/chet/bash/bash-20110317/lib/glob/xmbsrtowcs.c 2011-03-14 14:29:02.000000000 -0400 ---- xmbsrtowcs.c 2011-03-22 16:06:47.000000000 -0400 -*************** -*** 35,40 **** ---- 35,42 ---- - - #if HANDLE_MULTIBYTE - -+ #define WSBUF_INC 32 -+ - #ifndef FREE - # define FREE(x) do { if (x) free (x); } while (0) - #endif -*************** -*** 171,180 **** - /* Compute the number of produced wide-characters. */ - tmp_p = p; - tmp_state = state; -! wcslength = mbsnrtowcs (NULL, &tmp_p, nms, 0, &tmp_state); - - /* Conversion failed. */ -! if (wcslength == 0 || wcslength == (size_t)-1) - { - free (wsbuf); - *destp = NULL; ---- 173,193 ---- - /* Compute the number of produced wide-characters. */ - tmp_p = p; - tmp_state = state; -! -! if (nms == 0 && *p == '\\') /* special initial case */ -! nms = wcslength = 1; -! else -! wcslength = mbsnrtowcs (NULL, &tmp_p, nms, 0, &tmp_state); -! -! if (wcslength == 0) -! { -! tmp_p = p; /* will need below */ -! tmp_state = state; -! wcslength = 1; /* take a single byte */ -! } - - /* Conversion failed. */ -! if (wcslength == (size_t)-1) - { - free (wsbuf); - *destp = NULL; -*************** -*** 186,192 **** - { - wchar_t *wstmp; - -! wsbuf_size = wcnum+wcslength+1; /* 1 for the L'\0' or the potential L'\\' */ - - wstmp = (wchar_t *) realloc (wsbuf, wsbuf_size * sizeof (wchar_t)); - if (wstmp == NULL) ---- 199,206 ---- - { - wchar_t *wstmp; - -! while (wsbuf_size < wcnum+wcslength+1) /* 1 for the L'\0' or the potential L'\\' */ -! wsbuf_size += WSBUF_INC; - - wstmp = (wchar_t *) realloc (wsbuf, wsbuf_size * sizeof (wchar_t)); - if (wstmp == NULL) -*************** -*** 199,208 **** - } - - /* Perform the conversion. This is assumed to return 'wcslength'. -! * It may set 'p' to NULL. */ - n = mbsnrtowcs(wsbuf+wcnum, &p, nms, wsbuf_size-wcnum, &state); - -! wcnum += wcslength; - - if (mbsinit (&state) && (p != NULL) && (*p == '\\')) - { ---- 213,230 ---- - } - - /* Perform the conversion. This is assumed to return 'wcslength'. -! It may set 'p' to NULL. */ - n = mbsnrtowcs(wsbuf+wcnum, &p, nms, wsbuf_size-wcnum, &state); - -! /* Compensate for taking single byte on wcs conversion failure above. */ -! if (wcslength == 1 && (n == 0 || n == (size_t)-1)) -! { -! state = tmp_state; -! p = tmp_p; -! wsbuf[wcnum++] = *p++; -! } -! else -! wcnum += wcslength; - - if (mbsinit (&state) && (p != NULL) && (*p == '\\')) - { -*************** -*** 230,237 **** - If conversion is failed, the return value is (size_t)-1 and the values - of DESTP and INDICESP are NULL. */ - -- #define WSBUF_INC 32 -- - size_t - xdupmbstowcs (destp, indicesp, src) - wchar_t **destp; /* Store the pointer to the wide character string */ ---- 252,257 ---- |