From eb86e5298a018dbaf71ba252655335a62789a9fa Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Tue, 28 Aug 2012 16:20:45 +0000 Subject: [PATCH] Removed buggy burn_strdup() and burn_strndup(). Thanks to Rich Felker. --- cdrskin/cdrskin_timestamp.h | 2 +- libburn/drive.c | 2 +- libburn/sg-freebsd.c | 2 +- libburn/util.c | 36 ------------------------------------ libburn/util.h | 4 ---- 5 files changed, 3 insertions(+), 43 deletions(-) diff --git a/cdrskin/cdrskin_timestamp.h b/cdrskin/cdrskin_timestamp.h index 6ccf6aa..fe4bc01 100644 --- a/cdrskin/cdrskin_timestamp.h +++ b/cdrskin/cdrskin_timestamp.h @@ -1 +1 @@ -#define Cdrskin_timestamP "2012.07.26.122909" +#define Cdrskin_timestamP "2012.08.28.161949" diff --git a/libburn/drive.c b/libburn/drive.c index d288a37..1e8664c 100644 --- a/libburn/drive.c +++ b/libburn/drive.c @@ -69,7 +69,7 @@ extern int burn_drive_role_4_allowed; */ int burn_setup_drive(struct burn_drive *d, char *fname) { - d->devname = burn_strdup(fname); + d->devname = strdup(fname); memset(&d->params, 0, sizeof(struct params)); d->idata = NULL; d->mdata = NULL; diff --git a/libburn/sg-freebsd.c b/libburn/sg-freebsd.c index 387a3df..ca73b6b 100644 --- a/libburn/sg-freebsd.c +++ b/libburn/sg-freebsd.c @@ -448,7 +448,7 @@ static void enumerate_common(char *fname, int bus_no, int host_no, out.channel = channel_no; out.lun = lun_no; - out.devname = burn_strdup(fname); + out.devname = strdup(fname); out.cam = NULL; out.lock_fd = -1; diff --git a/libburn/util.c b/libburn/util.c index d86e6b7..a54b20c 100644 --- a/libburn/util.c +++ b/libburn/util.c @@ -23,42 +23,6 @@ #include "util.h" #include "libburn.h" -char *burn_strdup(char *s) -{ - char *ret; - int l; - - /* ts A61008 */ - /* a ssert(s); */ - if (s == NULL) - return NULL; - - l = strlen(s) + 1; - ret = calloc(1, l); - memcpy(ret, s, l); - - return ret; -} - -char *burn_strndup(char *s, int n) -{ - char *ret; - int l; - - /* ts A61008 */ - /* a ssert(s); */ - /* a ssert(n > 0); */ - if (s == NULL || n <= 0) - return NULL; - - l = strlen(s); - ret = calloc(1, l < n ? l : n); - - memcpy(ret, s, l < n - 1 ? l : n - 1); - ret[n - 1] = '\0'; - - return ret; -} void burn_version(int *major, int *minor, int *micro) { diff --git a/libburn/util.h b/libburn/util.h index fbc12e6..6f5db67 100644 --- a/libburn/util.h +++ b/libburn/util.h @@ -1,10 +1,6 @@ #ifndef __UTIL #define __UTIL -char *burn_strdup(char *s); - -char *burn_strndup(char *s, int n); - /* ts A90905 */ int burn_util_make_printable_word(char **text, int flag);