public inbox for ecos-patches@sourceware.org
 help / color / mirror / Atom feed
* Add strnlen()
@ 2010-05-11 16:17 Jonathan Larmour
  2010-05-11 16:26 ` Jonathan Larmour
  2010-05-12 10:21 ` Reminder: strlcat/strlcpy (was: Add strnlen()) Daniel Néri
  0 siblings, 2 replies; 4+ messages in thread
From: Jonathan Larmour @ 2010-05-11 16:17 UTC (permalink / raw)
  To: eCos Patches List

[-- Attachment #1: Type: text/plain, Size: 215 bytes --]

Ross Younger sent this addition of strnlen() to me off-list for review,
and after some feedback, I said it was ok, so here it is.

Jifl
-- 
--["No sense being pessimistic, it wouldn't work anyway"]-- Opinions==mine

[-- Attachment #2: wrypat.txt --]
[-- Type: text/plain, Size: 4341 bytes --]

Index: ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos/packages/language/c/libc/string/current/ChangeLog,v
retrieving revision 1.11
diff -u -5 -p -r1.11 ChangeLog
--- ChangeLog	29 Jan 2009 17:49:53 -0000	1.11
+++ ChangeLog	11 May 2010 16:13:52 -0000
@@ -1,5 +1,9 @@
+2010-05-10  Ross Younger  <wry@ecoscentric.com>
+
+	* src/strnlen.cxx, tests/strnlen.c: Created.
+
 2009-01-26  Jonathan Larmour  <jifl@eCosCentric.com>
 
 	* tests/memchr.c (main): Rename to cyg_user_start if main isn't
 	going to be called.
 	* tests/memcmp1.c (main): Ditto.
Index: cdl/string.cdl
===================================================================
RCS file: /cvs/ecos/ecos/packages/language/c/libc/string/current/cdl/string.cdl,v
retrieving revision 1.8
diff -u -5 -p -r1.8 string.cdl
--- cdl/string.cdl	29 Jan 2009 17:49:53 -0000	1.8
+++ cdl/string.cdl	11 May 2010 16:13:52 -0000
@@ -164,10 +164,20 @@ cdl_package CYGPKG_LIBC_STRING {
         compile       strdup.cxx
         description   "
                 This option indicates whether strdup() is to be supported."
     }
 
+    cdl_option CYGFUN_LIBC_STRING_GNU_STRNLEN {
+        display       "Provide strnlen() GNU extension"
+        flavor        bool
+        default_value 1
+        compile       strnlen.cxx
+        description   "
+            This option controls support for the strnlen() function.
+            (This is a GNU extension, not part of ANSI C.)"
+    }
+
     cdl_component CYGPKG_LIBC_STRING_OPTIONS {
         display "C library string functions build options"
         flavor  none
         no_define
         description   "
@@ -200,11 +210,11 @@ cdl_package CYGPKG_LIBC_STRING {
 
         cdl_option CYGPKG_LIBC_STRING_TESTS {
             display "C library string function tests"
             flavor  data
             no_define
-            calculated { "tests/memchr tests/memcmp1 tests/memcmp2 tests/memcpy1 tests/memcpy2 tests/memmove1 tests/memmove2 tests/memset tests/strcat1 tests/strcat2 tests/strchr tests/strcmp1 tests/strcmp2 tests/strcoll1 tests/strcoll2 tests/strcpy1 tests/strcpy2 tests/strcspn tests/strcspn tests/strlen tests/strncat1 tests/strncat2 tests/strncpy1 tests/strncpy2 tests/strpbrk tests/strrchr tests/strspn tests/strstr tests/strtok tests/strxfrm1 tests/strxfrm2" }
+            calculated { "tests/memchr tests/memcmp1 tests/memcmp2 tests/memcpy1 tests/memcpy2 tests/memmove1 tests/memmove2 tests/memset tests/strcat1 tests/strcat2 tests/strchr tests/strcmp1 tests/strcmp2 tests/strcoll1 tests/strcoll2 tests/strcpy1 tests/strcpy2 tests/strcspn tests/strcspn tests/strlen tests/strncat1 tests/strncat2 tests/strncpy1 tests/strncpy2 tests/strpbrk tests/strrchr tests/strspn tests/strstr tests/strtok tests/strxfrm1 tests/strxfrm2 tests/strnlen" }
             description   "
                 This option specifies the set of tests for the C library
                 string functions."
         }
     }
Index: include/string.h
===================================================================
RCS file: /cvs/ecos/ecos/packages/language/c/libc/string/current/include/string.h,v
retrieving revision 1.5
diff -u -5 -p -r1.5 string.h
--- include/string.h	29 Jan 2009 17:49:53 -0000	1.5
+++ include/string.h	11 May 2010 16:13:52 -0000
@@ -153,10 +153,16 @@ strlen( const char * );
 #ifndef __STRICT_ANSI__
 extern char *
 strdup( const char * );
 #endif
 
+// This is a GNU extension
+#ifdef CYGFUN_LIBC_STRING_GNU_STRNLEN
+extern size_t
+strnlen( const char *, size_t );
+#endif
+
 #ifdef __cplusplus
 }   /* extern "C" */
 #endif
 
 /* INLINE FUNCTIONS */
Index: include/stringsupp.hxx
===================================================================
RCS file: /cvs/ecos/ecos/packages/language/c/libc/string/current/include/stringsupp.hxx,v
retrieving revision 1.5
diff -u -5 -p -r1.5 stringsupp.hxx
--- include/stringsupp.hxx	29 Jan 2009 17:49:53 -0000	1.5
+++ include/stringsupp.hxx	11 May 2010 16:13:52 -0000
@@ -210,8 +210,14 @@ __strlen( const char * );
 
 // NB This is a BSD function
 __externC char *
 __strdup( const char * );
 
+// NB This is a GNU extension
+#ifdef CYGFUN_LIBC_STRING_GNU_STRNLEN
+__externC size_t
+__strnlen( const char *, size_t );
+#endif
+
 #endif // CYGONCE_LIBC_STRING_STRINGSUPP_HXX multiple inclusion protection
 
 // EOF stringsupp.hxx

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-05-12 13:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-05-11 16:17 Add strnlen() Jonathan Larmour
2010-05-11 16:26 ` Jonathan Larmour
2010-05-12 10:21 ` Reminder: strlcat/strlcpy (was: Add strnlen()) Daniel Néri
2010-05-12 13:04   ` Reminder: strlcat/strlcpy Jonathan Larmour

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).