1
0
mirror of https://github.com/moparisthebest/pacman synced 2024-08-13 17:03:46 -04:00

Remove strtrim function from backend

The last user of this was the code in the backend for loading packages,
but this no longer uses it.

Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
Dan McGee 2011-12-23 14:33:26 -06:00
parent a7cb150931
commit aac639351f
2 changed files with 0 additions and 42 deletions

View File

@ -188,47 +188,6 @@ cleanup:
return ret;
}
/** Trim leading and trailing whitespace, including newlines, from a string.
* Modifies str in place.
* @param str a string to trim
* @return str
*/
char *_alpm_strtrim(char *str)
{
char *pch = str;
if(*str == '\0') {
/* string is empty, so we're done. */
return str;
}
while(isspace((unsigned char)*pch)) {
pch++;
}
if(pch != str) {
size_t len = strlen(pch);
if(len) {
/* move the remaining string to the beginning of str */
memmove(str, pch, len + 1);
} else {
*str = '\0';
}
}
/* check if there wasn't anything but whitespace in the string. */
if(*str == '\0') {
return str;
}
pch = (str + (strlen(str) - 1));
while(isspace((unsigned char)*pch)) {
pch--;
}
*++pch = '\0';
return str;
}
/** Trim trailing newlines from a string (if any exist).
* @param str a single line of text
* @return the length of the trimmed string

View File

@ -113,7 +113,6 @@ enum _alpm_csum {
int _alpm_makepath(const char *path);
int _alpm_makepath_mode(const char *path, mode_t mode);
int _alpm_copyfile(const char *src, const char *dest);
char *_alpm_strtrim(char *str);
size_t _alpm_strip_newline(char *str);
int _alpm_open_archive(alpm_handle_t *handle, const char *path,