bug-global
[Top][All Lists]
Advanced

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

Re: Bug


From: Shigio YAMAGUCHI
Subject: Re: Bug
Date: Thu, 09 Aug 2012 11:44:17 +0900

Hi,
I have committed your code.
Thank you.

Congratulations on 22 (progress) gold medals.

Shigio
> 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.
--
Shigio YAMAGUCHI <address@hidden>
PGP fingerprint: D1CB 0B89 B346 4AB6 5663  C4B6 3CA5 BBB3 57BE DDA3



reply via email to

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