Changeset cbc8657


Ignore:
Timestamp:
Jul 23, 2011, 9:23:57 PM (13 years ago)
Author:
David Benjamin <davidben@mit.edu>
Branches:
master, release-1.10, release-1.9
Children:
39adf06, 3234121
Parents:
287c634
git-author:
David Benjamin <davidben@mit.edu> (07/23/11 19:05:47)
git-committer:
David Benjamin <davidben@mit.edu> (07/23/11 21:23:57)
Message:
Don't hardcode regerror buffer size

This lets us kill the silly LINE macro. regerror can be called first to
get the length, and then the data.
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • owl.h

    re5baf0a rcbc8657  
    205205#define OWL_META(key) ((key)|010000)
    206206/* OWL_CTRL is definied in kepress.c */
    207 
    208 #define LINE 2048
    209207
    210208#ifdef HAVE_LIBZEPHYR
  • regex.c

    rd427f08 rcbc8657  
    1111{
    1212  int ret;
    13   char buff1[LINE];
     13  size_t errbuf_size;
     14  char *errbuf;
    1415  const char *ptr;
    1516 
     
    2627  ret=regcomp(&(re->re), ptr, REG_EXTENDED|REG_ICASE);
    2728  if (ret) {
    28     regerror(ret, NULL, buff1, LINE);
    29     owl_function_makemsg("Error in regular expression: %s", buff1);
     29    errbuf_size = regerror(ret, NULL, NULL, 0);
     30    errbuf = g_new(char, errbuf_size);
     31    regerror(ret, NULL, errbuf, errbuf_size);
     32    owl_function_error("Error in regular expression: %s", errbuf);
     33    g_free(errbuf);
    3034    g_free(re->string);
    3135    re->string=NULL;
Note: See TracChangeset for help on using the changeset viewer.