X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f Message-ID: <464EC1BD.8060101@schluessler.org> Date: Sat, 19 May 2007 11:22:05 +0200 From: =?ISO-8859-1?Q?Timo_Schl=FC=DFler?= User-Agent: Thunderbird 1.5.0.7 (X11/20061202) MIME-Version: 1.0 To: djgpp AT delorie DOT com Subject: Re: How to count the occurance of a character in a string? References: <20070511181210 DOT GT3209 AT freenet DOT de> <20070512111553 DOT GO1881 AT freenet DOT de> <20070515164057 DOT GC1818 AT freenet DOT de> <20070516160358 DOT GA20179 AT freenet DOT de> <464B3526 DOT 2080909 AT schluessler DOT org> <464E15EA DOT DC2A59E2 AT yahoo DOT com> In-Reply-To: <464E15EA.DC2A59E2@yahoo.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-RZG-AUTH: lrVxSROSz8bd/08MH76VyqIxu4p9LgPLNDGEyLDcC+eGuhga3Dy2UTeqREeGyjldQSOBOuw= X-RZG-CLASS-ID: mo07 Reply-To: djgpp AT delorie DOT com CBFalconer schrieb: > > I hope not. Every one of those casts is unnecessary, and only > serves to conceal errors, such as failure to #include . > Besides which, there is no strdup routine in standard C. POSIX and > Linux may be different. It is available under DJGPP. > > Off course this is. The code I've sent was part from libiberty in the gcc source pakage. This routine is from glibc: char * __strdup (const char *s) { size_t len = strlen (s) + 1; void *new = malloc (len); if (new == NULL) return NULL; return (char *) memcpy (new, s, len); } But in fact it's not relevant where the code is from or whatever, the main is that it works. And the codes both are working. Timo