This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Allow multiple dlltools to be run concurrently in the same directory


On Sat, Jul 05, 2003 at 08:41:52AM -0400, Hans-Peter Nilsson wrote:
>On Fri, 4 Jul 2003, Christopher Faylor wrote:
>> Index: dlltool.c
>> +prefix_encode PARAMS ((char *start, unsigned code))
>>  {
>> -  if (!buf)
>> -    buf = malloc (strlen (tmp_prefix) + 17);
>> -  sprintf (buf, fmt, tmp_prefix);
>> +  static char alpha[] = "abcdefghijklmnopqrstuvwxyz";
>> +  static char buf[32];
>> +  char *p;
>> +  strcpy (buf, start);
>> +  p = strchr (buf, '\0');
>> +  do
>> +    *p++ = alpha[code % sizeof (alpha)];
>> +  while ((code /= sizeof (alpha)) != 0);
>
>I guess you want (sizeof (alpha) - 1) or strlen (alpha) or else
>it seems PID n*26 gets a short prefix.

Oops.  Right.  Thanks for catching this.

cgf

2003-07-05  Christopher Faylor  <cgf@redhat.com>

        * dlltool.c (prefix_encode): Use a fixed length for alpha.

Index: dlltool.c
===================================================================
RCS file: /cvs/src/src/binutils/dlltool.c,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -p -r1.41 -r1.42
--- dlltool.c	5 Jul 2003 02:58:29 -0000	1.41
+++ dlltool.c	5 Jul 2003 13:49:50 -0000	1.42
@@ -753,7 +753,7 @@ static void inform
 static char *
 prefix_encode PARAMS ((char *start, unsigned code))
 {
-  static char alpha[] = "abcdefghijklmnopqrstuvwxyz";
+  static char alpha[26] = "abcdefghijklmnopqrstuvwxyz";
   static char buf[32];
   char *p;
   strcpy (buf, start);


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]