*/
#include "buffer.h"
#include "mbsalign.h"
+#include "strutils.h"
void ul_buffer_reset_data(struct ul_buffer *buf)
{
if (!buf->end)
return -EINVAL; /* make static analyzers happy */
- memcpy(buf->end, data, sz);
- buf->end += sz;
+ buf->end = mempcpy(buf->end, data, sz);
*buf->end = '\0'; /* make sure it's terminated */
return 0;
}
#include "canonicalize.h"
#include "pathnames.h"
#include "all-io.h"
+#include "strutils.h"
/*
* Converts private "dm-N" names to "/dev/mapper/<name>"
if (!res)
return NULL;
- memcpy(p, cwd, csz);
- p += csz;
+ p = mempcpy(p, cwd, csz);
*p++ = '/';
memcpy(p, path, psz + 1);
r += 4;
*width += 4;
} else {
- memcpy(r, p, len);
- r += len;
+ r = mempcpy(r, p, len);
*width += wcwidth(wc);
}
p += len;
#include "blkidP.h"
#include "pathnames.h"
#include "sysfs.h"
+#include "strutils.h"
static char *blkid_strconcat(const char *a, const char *b, const char *c)
{
if (!res)
return NULL;
if (al) {
- memcpy(p, a, al);
- p += al;
+ p = mempcpy(p, a, al);
}
if (bl) {
- memcpy(p, b, bl);
- p += bl;
+ p = mempcpy(p, b, bl);
}
if (cl) {
- memcpy(p, c, cl);
- p += cl;
+ p = mempcpy(p, c, cl);
}
*p = '\0';
return res;
str += *sz;
if (a) {
- memcpy(str, a, asz);
- str += asz;
+ str = mempcpy(str, a, asz);
}
if (b) {
- memcpy(str, b, bsz);
- str += bsz;
+ str = mempcpy(str, b, bsz);
}
*str = '\0';
*sz = len;
if (p != str) {
/* copy chars before \u */
- memcpy(tp, str, p - str);
- tp += p - str;
+ tp = mempcpy(tp, str, p - str);
}
if (usz) {
/* copy username */
- memcpy(tp, username, usz);
- tp += usz;
+ tp = mempcpy(tp, username, usz);
}
if (*(p + 2))
/* copy chars after \u + \0 */
p = dest + dsz;
if (ssz) {
- memcpy(p, sep, ssz);
- p += ssz;
+ p = mempcpy(p, sep, ssz);
}
memcpy(p, src, sz);
*(p + sz) = '\0';