[pacman-dev] [PATCH] Removing strndup and a small typo fix
Laszlo Papp
djszapi2 at gmail.com
Tue Sep 1 20:49:02 EDT 2009
Code cleaning, removing strndup, because it's available with glibc in
the same manner, and a small typo fix.
Signed-off-by: Laszlo Papp <djszapi2 at gmail.com>
---
src/pacman/package.c | 2 +-
src/pacman/util.c | 12 ------------
src/pacman/util.h | 4 ----
3 files changed, 1 insertions(+), 17 deletions(-)
diff --git a/src/pacman/package.c b/src/pacman/package.c
index 328d5bf..3b14516 100644
--- a/src/pacman/package.c
+++ b/src/pacman/package.c
@@ -84,7 +84,7 @@ void dump_pkg_full(pmpkg_t *pkg, int level)
}
if(level>0) {
- /* compute this here so we don't get a puase in the middle of output */
+ /* compute this here so we don't get a pause in the middle of output */
requiredby = alpm_pkg_compute_requiredby(pkg);
}
diff --git a/src/pacman/util.c b/src/pacman/util.c
index a02b43c..a95d82e 100644
--- a/src/pacman/util.c
+++ b/src/pacman/util.c
@@ -819,18 +819,6 @@ static size_t strnlen(const char *s, size_t max)
for(p = s; *p && max--; ++p);
return(p - s);
}
-
-char *strndup(const char *s, size_t n)
-{
- size_t len = strnlen(s, n);
- char *new = (char *) malloc(len + 1);
-
- if (new == NULL)
- return NULL;
-
- new[len] = '\0';
- return (char *) memcpy(new, s, len);
-}
#endif
/* vim: set ts=2 sw=2 noet: */
diff --git a/src/pacman/util.h b/src/pacman/util.h
index 1282422..ce5e019 100644
--- a/src/pacman/util.h
+++ b/src/pacman/util.h
@@ -64,10 +64,6 @@ int pm_fprintf(FILE *stream, pmloglevel_t level, const char *format, ...) __attr
int pm_vfprintf(FILE *stream, pmloglevel_t level, const char *format, va_list args) __attribute__((format(printf,3,0)));
int pm_vasprintf(char **string, pmloglevel_t level, const char *format, va_list args) __attribute__((format(printf,3,0)));
-#ifndef HAVE_STRNDUP
-char *strndup(const char *s, size_t n);
-#endif
-
#endif /* _PM_UTIL_H */
/* vim: set ts=2 sw=2 noet: */
--
1.6.4.1
More information about the pacman-dev
mailing list