projects
/
pspp
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Use macros from cast.h instead of literal casts
[pspp]
/
src
/
libpspp
/
str.c
diff --git
a/src/libpspp/str.c
b/src/libpspp/str.c
index bde4de4be5bb4ee13edf877e217537336debfc0a..9f0cb6e31463ab5caf319114e43fed26f640ae2b 100644
(file)
--- a/
src/libpspp/str.c
+++ b/
src/libpspp/str.c
@@
-30,6
+30,7
@@
#include <relocatable.h>
#include "minmax.h"
#include "xalloc.h"
#include <relocatable.h>
#include "minmax.h"
#include "xalloc.h"
+#include "xmemdup0.h"
#include "xsize.h"
\f
/* Reverses the order of NBYTES bytes at address P, thus converting
#include "xsize.h"
\f
/* Reverses the order of NBYTES bytes at address P, thus converting
@@
-379,14
+380,13
@@
ss_tail (struct substring ss, size_t cnt)
return ss;
}
return ss;
}
-/* Makes a malloc()'d copy of the contents of OLD
+/* Makes a malloc()'d
, null-terminated
copy of the contents of OLD
and stores it in NEW. */
void
ss_alloc_substring (struct substring *new, struct substring old)
{
and stores it in NEW. */
void
ss_alloc_substring (struct substring *new, struct substring old)
{
- new->string = xm
alloc (
old.length);
+ new->string = xm
emdup0 (old.string,
old.length);
new->length = old.length;
new->length = old.length;
- memcpy (new->string, old.string, old.length);
}
/* Allocates room for a CNT-character string in NEW. */
}
/* Allocates room for a CNT-character string in NEW. */