/[bison]/bison/lib/strnlen.c
ViewVC logotype

Diff of /bison/lib/strnlen.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by akim, Thu Feb 8 14:32:10 2001 UTC revision 1.1.2.1 by eggert, Fri Oct 26 07:04:28 2001 UTC
# Line 1  Line 1 
1  /* Find the length of STRING, but scan at most MAXLEN characters.  /* Find the length of STRING, but scan at most MAXLEN characters.
2     Copyright (C) 1996, 1997, 1998, 2000 Free Software Foundation, Inc.     Copyright (C) 1996, 1997, 1998, 2000, 2001 Free Software Foundation, Inc.
3     This file is part of the GNU C Library.     This file is part of the GNU C Library.
4    
5     The GNU C Library is free software; you can redistribute it and/or     The GNU C Library is free software; you can redistribute it and/or
# Line 51  size_t Line 51  size_t
51  __strnlen (const char *string, size_t maxlen)  __strnlen (const char *string, size_t maxlen)
52  {  {
53    const char *end = memchr (string, '\0', maxlen);    const char *end = memchr (string, '\0', maxlen);
54    return end ? end - string : maxlen;    return end ? (size_t) (end - string) : maxlen;
55  }  }
56  #ifdef weak_alias  #ifdef weak_alias
57  weak_alias (__strnlen, strnlen)  weak_alias (__strnlen, strnlen)

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.1.2.1

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26