aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRamiro Polla <ramiro.polla@gmail.com>2007-06-29 22:13:50 +0000
committerRamiro Polla <ramiro.polla@gmail.com>2007-06-29 22:13:50 +0000
commit649282b7f966c96548011c68eef8527358049b97 (patch)
treefffe3a48bfc0b50124bb37878972ae3ae5e17f20
parente2c8fc0fb731112aaed61863b3f4f11e86e209ee (diff)
downloaddlfcn-win32-649282b7f966c96548011c68eef8527358049b97.tar.gz
dlfcn-win32-649282b7f966c96548011c68eef8527358049b97.tar.bz2
dlfcn-win32-649282b7f966c96548011c68eef8527358049b97.zip
Fix copy_string( )
-rw-r--r--dlfcn.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/dlfcn.c b/dlfcn.c
index 18eaa25..c279897 100644
--- a/dlfcn.c
+++ b/dlfcn.c
@@ -73,15 +73,16 @@ static int copy_string( char *dest, int dest_size, const char *src )
73{ 73{
74 int i = 0; 74 int i = 0;
75 75
76 if( src && dest ) 76 /* gcc should optimize this out */
77 if( !src && !dest )
78 return 0;
79
80 for( i = 0 ; i < dest_size-1 ; i++ )
77 { 81 {
78 for( i = 0 ; i < dest_size-1 ; i++ ) 82 if( !src[i] )
79 { 83 break;
80 if( !src[i] ) 84 else
81 break; 85 dest[i] = src[i];
82 else
83 dest[i] = src[i];
84 }
85 } 86 }
86 dest[i] = '\0'; 87 dest[i] = '\0';
87 88