[BACK]Return to tokenizer.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/tokenizer.c between version 1.20 and 1.21

version 1.20, 2011/07/29 15:16:33 version 1.21, 2011/08/16 16:25:15
Line 70  typedef enum {
Line 70  typedef enum {
   
 struct TYPE(tokenizer) {  struct TYPE(tokenizer) {
         Char    *ifs;           /* In field separator                    */          Char    *ifs;           /* In field separator                    */
         int      argc, amax;    /* Current and maximum number of args    */          size_t   argc, amax;    /* Current and maximum number of args    */
         Char   **argv;          /* Argument list                         */          Char   **argv;          /* Argument list                         */
         Char    *wptr, *wmax;   /* Space and limit on the word buffer    */          Char    *wptr, *wmax;   /* Space and limit on the word buffer    */
         Char    *wstart;        /* Beginning of next word                */          Char    *wstart;        /* Beginning of next word                */
Line 201  FUN(tok,line)(TYPE(Tokenizer) *tok, cons
Line 201  FUN(tok,line)(TYPE(Tokenizer) *tok, cons
                 if (ptr >= line->lastchar)                  if (ptr >= line->lastchar)
                         ptr = STR("");                          ptr = STR("");
                 if (ptr == line->cursor) {                  if (ptr == line->cursor) {
                         cc = tok->argc;                          cc = (int)tok->argc;
                         co = (int)(tok->wptr - tok->wstart);                          co = (int)(tok->wptr - tok->wstart);
                 }                  }
                 switch (*ptr) {                  switch (*ptr) {
Line 391  FUN(tok,line)(TYPE(Tokenizer) *tok, cons
Line 391  FUN(tok,line)(TYPE(Tokenizer) *tok, cons
                 }                  }
   
                 if (tok->wptr >= tok->wmax - 4) {                  if (tok->wptr >= tok->wmax - 4) {
                         size_t size = tok->wmax - tok->wspace + WINCR;                          size_t size = (size_t)(tok->wmax - tok->wspace + WINCR);
                         Char *s = tok_realloc(tok->wspace,                          Char *s = tok_realloc(tok->wspace,
                             size * sizeof(*s));                              size * sizeof(*s));
                         if (s == NULL)                          if (s == NULL)
                                 return -1;                                  return -1;
   
                         if (s != tok->wspace) {                          if (s != tok->wspace) {
                                 int i;                                  size_t i;
                                 for (i = 0; i < tok->argc; i++) {                                  for (i = 0; i < tok->argc; i++) {
                                     tok->argv[i] =                                      tok->argv[i] =
                                         (tok->argv[i] - tok->wspace) + s;                                          (tok->argv[i] - tok->wspace) + s;
Line 420  FUN(tok,line)(TYPE(Tokenizer) *tok, cons
Line 420  FUN(tok,line)(TYPE(Tokenizer) *tok, cons
         }          }
  tok_line_outok:   tok_line_outok:
         if (cc == -1 && co == -1) {          if (cc == -1 && co == -1) {
                 cc = tok->argc;                  cc = (int)tok->argc;
                 co = (int)(tok->wptr - tok->wstart);                  co = (int)(tok->wptr - tok->wstart);
         }          }
         if (cursorc != NULL)          if (cursorc != NULL)
Line 429  FUN(tok,line)(TYPE(Tokenizer) *tok, cons
Line 429  FUN(tok,line)(TYPE(Tokenizer) *tok, cons
                 *cursoro = co;                  *cursoro = co;
         FUN(tok,finish)(tok);          FUN(tok,finish)(tok);
         *argv = (const Char **)tok->argv;          *argv = (const Char **)tok->argv;
         *argc = tok->argc;          *argc = (int)tok->argc;
         return 0;          return 0;
 }  }
   

Legend:
Removed from v.1.20  
changed lines
  Added in v.1.21

CVSweb <webmaster@jp.NetBSD.org>