[BACK]Return to readline.c CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / lib / libedit

Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.

Diff for /src/lib/libedit/readline.c between version 1.62 and 1.63

version 1.62, 2006/03/18 09:15:57 version 1.63, 2006/03/18 09:19:02
Line 853  history_expand(char *str, char **output)
Line 853  history_expand(char *str, char **output)
                         return 0;                          return 0;
         }          }
   
 #define ADD_STRING(what, len)                                           \  #define ADD_STRING(what, len, fr)                                       \
         {                                                               \          {                                                               \
                 if (idx + len + 1 > size) {                             \                  if (idx + len + 1 > size) {                             \
                         char *nresult = realloc(result, (size += len + 1));\                          char *nresult = realloc(result, (size += len + 1));\
                         if (nresult == NULL) {                          \                          if (nresult == NULL) {                          \
                                 free(*output);                          \                                  free(*output);                          \
                                   if (fr)                                 \
                                           free(tmp);                      \
                                 return 0;                               \                                  return 0;                               \
                         }                                               \                          }                                               \
                         result = nresult;                               \                          result = nresult;                               \
Line 908  loop:
Line 910  loop:
                 }                  }
                 len = i - start;                  len = i - start;
                 tmp = &str[start];                  tmp = &str[start];
                 ADD_STRING(tmp, len);                  ADD_STRING(tmp, len, 0);
   
                 if (str[i] == '\0' || str[i] != history_expansion_char) {                  if (str[i] == '\0' || str[i] != history_expansion_char) {
                         len = j - i;                          len = j - i;
                         tmp = &str[i];                          tmp = &str[i];
                         ADD_STRING(tmp, len);                          ADD_STRING(tmp, len, 0);
                         if (start == 0)                          if (start == 0)
                                 ret = 0;                                  ret = 0;
                         else                          else
Line 923  loop:
Line 925  loop:
                 ret = _history_expand_command (str, i, (j - i), &tmp);                  ret = _history_expand_command (str, i, (j - i), &tmp);
                 if (ret > 0 && tmp) {                  if (ret > 0 && tmp) {
                         len = strlen(tmp);                          len = strlen(tmp);
                         ADD_STRING(tmp, len);                          ADD_STRING(tmp, len, 1);
                         free(tmp);                          free(tmp);
                 }                  }
                 i = j;                  i = j;

Legend:
Removed from v.1.62  
changed lines
  Added in v.1.63

CVSweb <webmaster@jp.NetBSD.org>