/[pcre]/code/trunk/pcregrep.c
ViewVC logotype

Diff of /code/trunk/pcregrep.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 122 by ph10, Mon Mar 12 12:12:47 2007 UTC revision 123 by ph10, Mon Mar 12 15:19:06 2007 UTC
# Line 1866  hints_list = (pcre_extra **)malloc(MAX_P Line 1866  hints_list = (pcre_extra **)malloc(MAX_P
1866  if (pattern_list == NULL || hints_list == NULL)  if (pattern_list == NULL || hints_list == NULL)
1867    {    {
1868    fprintf(stderr, "pcregrep: malloc failed\n");    fprintf(stderr, "pcregrep: malloc failed\n");
1869    goto EXIT2;    goto EXIT2;
1870    }    }
1871    
1872  /* If no patterns were provided by -e, and there is no file provided by -f,  /* If no patterns were provided by -e, and there is no file provided by -f,
# Line 1885  for (j = 0; j < cmd_pattern_count; j++) Line 1885  for (j = 0; j < cmd_pattern_count; j++)
1885    {    {
1886    if (!compile_pattern(patterns[j], pcre_options, NULL,    if (!compile_pattern(patterns[j], pcre_options, NULL,
1887         (j == 0 && cmd_pattern_count == 1)? 0 : j + 1))         (j == 0 && cmd_pattern_count == 1)? 0 : j + 1))
1888      goto EXIT2;      goto EXIT2;
1889    }    }
1890    
1891  /* Compile the regular expressions that are provided in a file. */  /* Compile the regular expressions that are provided in a file. */
# Line 1909  if (pattern_filename != NULL) Line 1909  if (pattern_filename != NULL)
1909        {        {
1910        fprintf(stderr, "pcregrep: Failed to open %s: %s\n", pattern_filename,        fprintf(stderr, "pcregrep: Failed to open %s: %s\n", pattern_filename,
1911          strerror(errno));          strerror(errno));
1912        goto EXIT2;        goto EXIT2;
1913        }        }
1914      filename = pattern_filename;      filename = pattern_filename;
1915      }      }
# Line 1974  if (i >= argc) Line 1974  if (i >= argc)
1974    {    {
1975    rc = pcregrep(stdin, (filenames > FN_DEFAULT)? stdin_name : NULL);    rc = pcregrep(stdin, (filenames > FN_DEFAULT)? stdin_name : NULL);
1976    goto EXIT;    goto EXIT;
1977    }    }
1978    
1979  /* Otherwise, work through the remaining arguments as files or directories.  /* Otherwise, work through the remaining arguments as files or directories.
1980  Pass in the fact that there is only one argument at top level - this suppresses  Pass in the fact that there is only one argument at top level - this suppresses
# Line 1994  for (; i < argc; i++) Line 1994  for (; i < argc; i++)
1994  EXIT:  EXIT:
1995  if (pattern_list != NULL)  if (pattern_list != NULL)
1996    {    {
1997    for (i = 0; i < pattern_count; i++) free(pattern_list[i]);    for (i = 0; i < pattern_count; i++) free(pattern_list[i]);
1998    free(pattern_list);    free(pattern_list);
1999    }    }
2000  if (hints_list != NULL)  if (hints_list != NULL)
2001    {    {
2002    for (i = 0; i < pattern_count; i++) free(hints_list[i]);    for (i = 0; i < pattern_count; i++) free(hints_list[i]);
2003    free(hints_list);    free(hints_list);
2004    }    }
2005  return rc;  return rc;
2006    
2007  EXIT2:  EXIT2:

Legend:
Removed from v.122  
changed lines
  Added in v.123

webmaster@exim.org
ViewVC Help
Powered by ViewVC 1.1.12