Use string_rtrim()

This commit is contained in:
Pierre Pronchery 2015-06-23 03:28:31 +02:00
parent 1802bcf72f
commit 1f8636edad
2 changed files with 4 additions and 5 deletions

View File

@ -2722,7 +2722,7 @@ static char * _location_real_path(char const * path)
if(i >= 2 && strcmp(&p[i - 2], "/.") == 0)
p[i - 1] = '\0';
/* trim slashes in the end */
for(i = strlen(p); i > 1 && p[--i] == '/'; p[i] = '\0');
string_rtrim(p, "/");
#ifdef DEBUG
fprintf(stderr, "DEBUG: %s(\"%s\") => \"%s\"\n", __func__, path, p);
#endif

View File

@ -21,7 +21,6 @@
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#define COMMON_RTRIM
#include "common.c"
@ -496,7 +495,7 @@ static char * _cvs_get_repository(char const * pathname)
return NULL;
snprintf(p, len, "%s/%s", pathname, repository);
if(g_file_get_contents(p, &ret, NULL, NULL) == TRUE)
_common_rtrim(ret);
string_rtrim(ret, NULL);
free(p);
return ret;
}
@ -515,7 +514,7 @@ static char * _cvs_get_root(char const * pathname)
return NULL;
snprintf(p, len, "%s/%s", pathname, root);
if(g_file_get_contents(p, &ret, NULL, NULL) == TRUE)
_common_rtrim(ret);
string_rtrim(ret, NULL);
free(p);
return ret;
}
@ -534,7 +533,7 @@ static char * _cvs_get_tag(char const * pathname)
return NULL;
snprintf(p, len, "%s/%s", pathname, tag);
if(g_file_get_contents(p, &ret, NULL, NULL) == TRUE)
_common_rtrim(ret);
string_rtrim(ret, NULL);
free(p);
return ret;
}