From 88df438bb4c0a0c024238945851ec2d63479fbf5 Mon Sep 17 00:00:00 2001 From: tantricity Date: Sat, 3 Apr 2010 19:28:17 +0000 Subject: [PATCH] smb - partial undo git-svn-id: https://devkitpro.svn.sourceforge.net/svnroot/devkitpro/trunk/libogc@4053 258c5a1a-4f63-435d-9564-e8f6d34ab52c --- libtinysmb/smb_devoptab.c | 41 +++++------------------------------------ 1 file changed, 5 insertions(+), 36 deletions(-) diff --git a/libtinysmb/smb_devoptab.c b/libtinysmb/smb_devoptab.c index d15ab58..43282e8 100644 --- a/libtinysmb/smb_devoptab.c +++ b/libtinysmb/smb_devoptab.c @@ -458,38 +458,6 @@ failed: // END CACHE FUNCTIONS // /////////////////////////////////////////// -void str_replace(char *str, char *old, char *new) -{ - int i, count = 0; - int newlen = strlen(new); - int oldlen = strlen(old); - - for (i = 0; str[i]; ++i) - if (strstr(&str[i], old) == &str[i]) - ++count, i += oldlen - 1; - - char *ret = (char *) calloc(i + 1 + count * (newlen - oldlen), sizeof(char)); - if (!ret) return; - - i = 0; - while (*str) - { - if (strstr(str, old) == str) - { - strcpy(&ret[i], new); - i += newlen; - str += oldlen; - } - else - { - ret[i++] = *str++; - } - } - ret[i] = '\0'; - strcpy(str, ret); - free(ret); -} - static char *smb_absolute_path_no_device(const char *srcpath, char *destpath, int env) { if (strchr(srcpath, ':') != NULL) @@ -510,10 +478,11 @@ static char *smb_absolute_path_no_device(const char *srcpath, char *destpath, in { strcpy(destpath, srcpath); } - - str_replace(destpath,"//","\\"); - str_replace(destpath,"/","\\"); - str_replace(destpath,"\\\\","\\"); + int i, l; + l = strlen(destpath); + for (i = 0; i < l; i++) + if (destpath[i] == '/') + destpath[i] = '\\'; return destpath; } -- 2.11.4.GIT