www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2014/01/14/17:18:18

X-Authentication-Warning: delorie.com: mail set sender to djgpp-workers-bounces using -f
X-Recipient: djgpp-workers AT delorie DOT com
Message-ID: <52D5AA05.5030304@gmx.de>
Date: Tue, 14 Jan 2014 22:20:05 +0100
From: Juan Manuel Guerrero <juan DOT guerrero AT gmx DOT de>
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0
MIME-Version: 1.0
To: djgpp-workers AT delorie DOT com
Subject: Re: Implementation of mkdtemp.
References: <201401141024 DOT s0EAO5jE018027 AT dexter DOT ludd DOT ltu DOT se>
In-Reply-To: <201401141024.s0EAO5jE018027@dexter.ludd.ltu.se>
X-Provags-ID: V03:K0:26joSuceZo8R1lAQtRyNIFjI2QjJODZw8hmTzpZDHm657VzdmEZ
idVp09PRMcyBySz47Ed/Kr2SOpLB/g8Vz7y8M3Go/skMjMjtapE1dsAn8XpYl/XV/Fbbp+w
O1wEOlaVFan8IUh0DwVdcTCMyCHtW1r5zmaQYjrTp1gaJ8OS3k06gyJ1ZOT4TLTGusJiusL
bwFFehsMA+xP9khv0D+Og==
Reply-To: djgpp-workers AT delorie DOT com

Am 14.01.2014 11:24, schrieb Martin Str|mberg:
> According to Juan Manuel Guerrero:
>> diff -aprNU5 djgpp.orig/src/libc/compat/stdio/mktemp.c djgpp/src/libc/compat/stdio/mktemp.c
>> --- djgpp.orig/src/libc/compat/stdio/mktemp.c    2013-12-31 14:54:02 +0100
>> +++ djgpp/src/libc/compat/stdio/mktemp.c    2014-01-09 22:24:06 +0100
>> @@ -1,82 +1,99 @@
>> +/* Copyright (C) 2014 DJ Delorie, see COPYING.DJ for details */
>>    /* Copyright (C) 2013 DJ Delorie, see COPYING.DJ for details */
>>    /* Copyright (C) 2009 DJ Delorie, see COPYING.DJ for details */
>>    /* Copyright (C) 2000 DJ Delorie, see COPYING.DJ for details */
>>    /* Copyright (C) 1996 DJ Delorie, see COPYING.DJ for details */
>>    /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
>>    #include <libc/stubs.h>
>>    #include <libc/bss.h>
>>    #include <libc/symlink.h>
>> +#include <fcntl.h>
>>    #include <unistd.h>
>>    #include <stdlib.h>
>>    #include <stdio.h>
>>    #include <string.h>
>> +#include <errno.h>
>>
>>    static int mktemp_count = -1;
>>
>>    char *
>>    mktemp(char *_template)
>>    {
>> -  static int count = 0;
>> -  char *cp, *dp;
>> -  int i, len, xcount, loopcnt;
>> -  char real_path[FILENAME_MAX];
>> +  register int i, len, xcount;
>> +  unsigned int use_lfn = _USE_LFN;
> Hrrm... Declaring variables with register in C is considered bad form
> nowadays.
>
> May I ask why you'd do so?
>
>
> Nevertheless, thanks for all your work.
>
>
Hope the compiler optimizes as good as me. ;-)

Regards,
Juan M. Guerrero



Logging in to :pserver:anonymous AT cvs DOT delorie DOT com:2401/cvs/djgpp
Index: djgpp/src/libc/compat/stdio/mktemp.c
===================================================================
RCS file: /cvs/djgpp/djgpp/src/libc/compat/stdio/mktemp.c,v
retrieving revision 1.5
diff -p -U 5 -r1.5 mktemp.c
--- djgpp/src/libc/compat/stdio/mktemp.c    10 Jan 2014 20:16:49 -0000    1.5
+++ djgpp/src/libc/compat/stdio/mktemp.c    14 Jan 2014 21:36:25 -0000
@@ -17,11 +17,11 @@
  static int mktemp_count = -1;

  char *
  mktemp(char *_template)
  {
-  register int i, len, xcount;
+  int i, len, xcount;
    unsigned int use_lfn = _USE_LFN;

    for (i = 0; _template[i]; i++)
      ;
    for (xcount = 0, len = i; xcount < 6  && _template[--i] == 'X'; xcount++)

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019