bug-global
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Bug


From: Simon D
Subject: Bug
Date: Wed, 8 Aug 2012 20:19:45 +0100


Hi, my name is Simon Dommett from the UK, got a possible bug for you.
 
I am using global version 6.2.4
 
You should change the tolower() code in /htags/incop.c [strtolower()] and
  /libutil/locatestring.c [strincmp()], as on some systems they
 are #define macros, where the argument gets evaluated more than once.
 
Change into something like this:
 
//  /htags/incop.c
static const char *
strtolower(const char *s)
{
 static char lower[MAXPATHLEN];
 char *t = lower, *end = lower + sizeof(lower);
 
 do {
  if (t == end)
   die("name is too long.");
 
  *t = tolower((unsigned char)*s);
  s++;
 } while (*t++ != '\0');
 
 return lower;
}
 
//=====================================================
// /libutil/locatestring.c
 
static int
strincmp(const char *string, const char *pattern, size_t len)
{
 unsigned char s, p;
 
 while (len--) {
  s = tolower((unsigned char)*string);
  p = tolower((unsigned char)*pattern);
  if (s != p)
   return s - p;
  if (s == 0)
   break;
  string++;
  pattern++;
 }
 return 0;
}
 
 
You may use these code snippets however you like (placed into the public domain).
 
=========================================================
I have been converting your function header comments into Doxygen comments,
 will be sending diffs in 3 to 4 weeks time.
 
Please don't make my email address publicly viewable.
Thank you.

 

reply via email to

[Prev in Thread] Current Thread [Next in Thread]