#include <stdarg.h>
#include <stdio.h>
#include <string.h>
+#include <sys/types.h>
#include "config.h"
+#include "common.h"
#include "lib.h"
-char *xmstrcat3save(const char *a, const char *b, const char *c) {
+char *xstrcat3save(const char *a, const char *b, const char *c) {
char *r;
r= xmalloc(strlen(a)+strlen(b)+strlen(c)+1);
return r;
}
-char *xmstrsave(const char *s) {
+char *xstrsave(const char *s) {
char *r;
r= xmalloc(strlen(s)+1);
return r;
}
-char *xmstrsubsave(const char *begin, int len) {
+char *xstrsubsave(const char *begin, int len) {
char *r;
r= xmalloc(len+1);
return p;
}
-char *xstrdup(const char *str) {
- char *r;
- r= xmalloc(strlen(str)+1);
- strcpy(r,str); return r;
-}
-
-void makeroom(char **buffer, int *size, int needed) {
- if (*size >= needed) return;
+int makeroom(char **buffer, int *size, int needed) {
+ if (needed > MAX_GENERAL_STRING) return -1;
+ if (*size >= needed) return 0;
*buffer= xrealloc(*buffer,needed);
*size= needed;
+ return 0;
}
void vsnyprintf(char *buffer, size_t size, const char *fmt, va_list al) {