ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/strings.C
(Generate patch)

Comparing rxvt-unicode/src/strings.C (file contents):
Revision 1.5 by pcg, Fri Feb 13 12:16:21 2004 UTC vs.
Revision 1.9 by root, Fri Jan 6 05:37:59 2006 UTC

1/*--------------------------------*-C-*---------------------------------* 1/*--------------------------------*-C-*---------------------------------*
2 * File: strings.c 2 * File: strings.C
3 *----------------------------------------------------------------------* 3 *----------------------------------------------------------------------*
4 * $Id: strings.C,v 1.5 2004/02/13 12:16:21 pcg Exp $
5 * 4 *
6 * All portions of code are copyright by their respective author/s. 5 * All portions of code are copyright by their respective author/s.
7 * Copyright (c) 1997-2001 Geoff Wing <gcw@pobox.com> 6 * Copyright (c) 1997-2001 Geoff Wing <gcw@pobox.com>
7 * Copyright (c) 2004-2006 Marc Lehmann <pcg@goof.com>
8 * 8 *
9 * This program is free software; you can redistribute it and/or modify 9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by 10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or 11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version. 12 * (at your option) any later version.
21 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 21 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 *----------------------------------------------------------------------*/ 22 *----------------------------------------------------------------------*/
23 23
24#include "../config.h" /* NECESSARY */ 24#include "../config.h" /* NECESSARY */
25#include "rxvt.h" /* NECESSARY */ 25#include "rxvt.h" /* NECESSARY */
26#include "strings.intpro" /* PROTOS for internal routines */
27 26
28#ifndef NO_STRINGS 27#ifndef NO_STRINGS
29/*----------------------------------------------------------------------*/ 28/*----------------------------------------------------------------------*/
30/* 29/*
31 * a replacement for strcasecmp () to avoid linking an entire library. 30 * a replacement for strcasecmp () to avoid linking an entire library.
132} 131}
133 132
134char * 133char *
135strdup (const char *s) 134strdup (const char *s)
136{ 135{
137 size_t len = STRLEN (s) + 1; 136 size_t len = strlen (s) + 1;
138 char *c; 137 char *c;
139 138
140 if ((c = malloc (len)) != NULL) 139 if ((c = malloc (len)) != NULL)
141 MEMCPY (c, s, len); 140 memcpy (c, s, len);
142 return c; 141 return c;
143} 142}
144 143
145char * 144char *
146index (const char *s, int c) 145index (const char *s, int c)
147{ 146{
148 return STRCHR (s, c); 147 return strchr (s, c);
149} 148}
150 149
151char * 150char *
152strchr (const char *s, int c) 151strchr (const char *s, int c)
153{ 152{
168} 167}
169 168
170char * 169char *
171rindex (const char *s, int c) 170rindex (const char *s, int c)
172{ 171{
173 return STRRCHR (s, c); 172 return strrchr (s, c);
174} 173}
175 174
176char * 175char *
177strrchr (const char *s, int c) 176strrchr (const char *s, int c)
178{ 177{
190 189
191void * 190void *
192memcpy (void *s1, const void *s2, size_t len) 191memcpy (void *s1, const void *s2, size_t len)
193{ 192{
194 /* has extra stack and time but less code space */ 193 /* has extra stack and time but less code space */
195 return MEMMOVE (s1, s2, len); 194 return memmove (s1, s2, len);
196} 195}
197 196
198/*--------------------------------------------------------------------------* 197/*--------------------------------------------------------------------------*
199 * Possibly faster memmove () by Geoff Wing <mason@primenet.com.au> 198 * Possibly faster memmove () by Geoff Wing <mason@primenet.com.au>
200 *--------------------------------------------------------------------------*/ 199 *--------------------------------------------------------------------------*/
255 *--------------------------------------------------------------------------*/ 254 *--------------------------------------------------------------------------*/
256 255
257void 256void
258bzero (void *b, size_t len) 257bzero (void *b, size_t len)
259{ 258{
260 MEMSET (b, 0, len); 259 memset (b, 0, len);
261} 260}
262 261
263void * 262void *
264memset (void *p, int c1, size_t len) 263memset (void *p, int c1, size_t len)
265{ 264{

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines