Use string_rtrim()
This commit is contained in:
parent
1802bcf72f
commit
1f8636edad
@ -2722,7 +2722,7 @@ static char * _location_real_path(char const * path)
|
|||||||
if(i >= 2 && strcmp(&p[i - 2], "/.") == 0)
|
if(i >= 2 && strcmp(&p[i - 2], "/.") == 0)
|
||||||
p[i - 1] = '\0';
|
p[i - 1] = '\0';
|
||||||
/* trim slashes in the end */
|
/* trim slashes in the end */
|
||||||
for(i = strlen(p); i > 1 && p[--i] == '/'; p[i] = '\0');
|
string_rtrim(p, "/");
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
fprintf(stderr, "DEBUG: %s(\"%s\") => \"%s\"\n", __func__, path, p);
|
fprintf(stderr, "DEBUG: %s(\"%s\") => \"%s\"\n", __func__, path, p);
|
||||||
#endif
|
#endif
|
||||||
|
@ -21,7 +21,6 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#define COMMON_RTRIM
|
|
||||||
#include "common.c"
|
#include "common.c"
|
||||||
|
|
||||||
|
|
||||||
@ -496,7 +495,7 @@ static char * _cvs_get_repository(char const * pathname)
|
|||||||
return NULL;
|
return NULL;
|
||||||
snprintf(p, len, "%s/%s", pathname, repository);
|
snprintf(p, len, "%s/%s", pathname, repository);
|
||||||
if(g_file_get_contents(p, &ret, NULL, NULL) == TRUE)
|
if(g_file_get_contents(p, &ret, NULL, NULL) == TRUE)
|
||||||
_common_rtrim(ret);
|
string_rtrim(ret, NULL);
|
||||||
free(p);
|
free(p);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -515,7 +514,7 @@ static char * _cvs_get_root(char const * pathname)
|
|||||||
return NULL;
|
return NULL;
|
||||||
snprintf(p, len, "%s/%s", pathname, root);
|
snprintf(p, len, "%s/%s", pathname, root);
|
||||||
if(g_file_get_contents(p, &ret, NULL, NULL) == TRUE)
|
if(g_file_get_contents(p, &ret, NULL, NULL) == TRUE)
|
||||||
_common_rtrim(ret);
|
string_rtrim(ret, NULL);
|
||||||
free(p);
|
free(p);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -534,7 +533,7 @@ static char * _cvs_get_tag(char const * pathname)
|
|||||||
return NULL;
|
return NULL;
|
||||||
snprintf(p, len, "%s/%s", pathname, tag);
|
snprintf(p, len, "%s/%s", pathname, tag);
|
||||||
if(g_file_get_contents(p, &ret, NULL, NULL) == TRUE)
|
if(g_file_get_contents(p, &ret, NULL, NULL) == TRUE)
|
||||||
_common_rtrim(ret);
|
string_rtrim(ret, NULL);
|
||||||
free(p);
|
free(p);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user