[MPlayer-cvslog] r21875 - in trunk: configure osdep/Makefile osdep/strl.c osdep/strlcat.c osdep/strlcpy.c

diego subversion at mplayerhq.hu
Wed Jan 10 21:23:24 CET 2007


Author: diego
Date: Wed Jan 10 21:23:24 2007
New Revision: 21875

Added:
   trunk/osdep/strlcat.c
      - copied, changed from r21867, /trunk/osdep/strl.c
   trunk/osdep/strlcpy.c
      - copied, changed from r21867, /trunk/osdep/strl.c
Removed:
   trunk/osdep/strl.c
Modified:
   trunk/configure
   trunk/osdep/Makefile

Log:
Split strl.c into strl(cat|cpy).c and move #ifdefs into the build system.


Modified: trunk/configure
==============================================================================
--- trunk/configure	(original)
+++ trunk/configure	Wed Jan 10 21:23:24 2007
@@ -3411,8 +3411,10 @@
 cc_check && _strlcpy=yes
 if test "$_strlcpy" = yes ; then
  _def_strlcpy='#define HAVE_STRLCPY 1'
+ _need_strlcpy=no
 else
  _def_strlcpy='#undef HAVE_STRLCPY'
+ _need_strlcpy=yes
 fi
 echores "$_strlcpy"
 
@@ -3425,8 +3427,10 @@
 cc_check && _strlcat=yes
 if test "$_strlcat" = yes ; then
  _def_strlcat='#define HAVE_STRLCAT 1'
+ _need_strlcat=no
 else
  _def_strlcat='#undef HAVE_STRLCAT'
+ _need_strlcat=yes
 fi
 echores "$_strlcat"
 
@@ -7488,6 +7492,8 @@
 NEED_GLOB    = $_need_glob
 NEED_SCANDIR = $_need_scandir
 NEED_SETENV  = $_need_setenv
+NEED_STRLCAT = $_need_strlcat
+NEED_STRLCPY = $_need_strlcpy
 NEED_STRSEP  = $_need_strsep
 NEED_SWAB    = $_need_swab
 NEED_VSSCANF = $_need_vsscanf

Modified: trunk/osdep/Makefile
==============================================================================
--- trunk/osdep/Makefile	(original)
+++ trunk/osdep/Makefile	Wed Jan 10 21:23:24 2007
@@ -3,8 +3,6 @@
 
 LIBNAME = libosdep.a
 
-SRCS= strl.c \
-
 SRCS-$(HAVE_SYS_MMAN_H)       += mmap_anon.c
 SRCS-$(MACOSX_FINDER_SUPPORT) += macosx_finder_args.c
 ifneq ($(TARGET_OS),MINGW32)
@@ -16,6 +14,8 @@
 SRCS-$(NEED_GETTIMEOFDAY)     += gettimeofday.c
 SRCS-$(NEED_SCANDIR)          += scandir.c
 SRCS-$(NEED_SETENV)           += setenv.c
+SRCS-$(NEED_STRLCAT)          += strlcat.c
+SRCS-$(NEED_STRLCPY)          += strlcpy.c
 SRCS-$(NEED_STRSEP)           += strsep.c
 SRCS-$(NEED_SWAB)             += swab.c
 SRCS-$(NEED_VSSCANF)          += vsscanf.c

Copied: trunk/osdep/strlcat.c (from r21867, /trunk/osdep/strl.c)
==============================================================================
--- /trunk/osdep/strl.c	(original)
+++ trunk/osdep/strlcat.c	Wed Jan 10 21:23:24 2007
@@ -1,30 +1,10 @@
-/* strl(cat|cpy) implementation for systems that do not have it in libc */
-/* strl.c - strlcpy/strlcat implementation
+/* strlcat implementation for systems that do not have it in libc
  * Time-stamp: <2004-03-14 njk>
  * (C) 2003-2004 Nicholas J. Kain <njk at aerifal.cx>
  */
 
 #include "config.h"
 
-#ifndef HAVE_STRLCPY
-unsigned int strlcpy (char *dest, const char *src, unsigned int size)
-{
-	register unsigned int i = 0;
-
-	if (size > 0) {
-	size--;
-	for (i=0; size > 0 && src[i] != '\0'; ++i, size--)
-		dest[i] = src[i];
-
-	dest[i] = '\0';
-	}
-	while (src[i++]);
-
-	return i;
-}
-#endif
-
-#ifndef HAVE_STRLCAT
 unsigned int strlcat (char *dest, const char *src, unsigned int size)
 {
 	register char *d = dest;
@@ -32,5 +12,4 @@
 	for (; size > 0 && *d != '\0'; size--, d++);
 	return (d - dest) + strlcpy(d, src, size);
 }
-#endif
 

Copied: trunk/osdep/strlcpy.c (from r21867, /trunk/osdep/strl.c)
==============================================================================
--- /trunk/osdep/strl.c	(original)
+++ trunk/osdep/strlcpy.c	Wed Jan 10 21:23:24 2007
@@ -1,12 +1,10 @@
-/* strl(cat|cpy) implementation for systems that do not have it in libc */
-/* strl.c - strlcpy/strlcat implementation
+/* strlcpy implementation for systems that do not have it in libc
  * Time-stamp: <2004-03-14 njk>
  * (C) 2003-2004 Nicholas J. Kain <njk at aerifal.cx>
  */
 
 #include "config.h"
 
-#ifndef HAVE_STRLCPY
 unsigned int strlcpy (char *dest, const char *src, unsigned int size)
 {
 	register unsigned int i = 0;
@@ -22,15 +20,3 @@
 
 	return i;
 }
-#endif
-
-#ifndef HAVE_STRLCAT
-unsigned int strlcat (char *dest, const char *src, unsigned int size)
-{
-	register char *d = dest;
-
-	for (; size > 0 && *d != '\0'; size--, d++);
-	return (d - dest) + strlcpy(d, src, size);
-}
-#endif
-



More information about the MPlayer-cvslog mailing list