-/* $Id: xstd.c,v 1.4 2009/01/20 13:44:05 kristaps Exp $ */
+/* $Id: xstd.c,v 1.7 2009/03/06 14:13:47 kristaps Exp $ */
/*
* Copyright (c) 2008 Kristaps Dzonsons <kristaps@kth.se>
*
extern size_t strlcpy(char *, const char *, size_t);
#endif
+
+int
+xstrncmp(const char *p1, const char *p2, size_t sz)
+{
+
+ return(0 == strncmp(p1, p2, sz));
+}
+
int
xstrcmp(const char *p1, const char *p2)
{
return(strlcpy(dst, src, sz) < sz);
}
+void *
+xrealloc(void *ptr, size_t sz)
+{
+ void *p;
+
+ if (NULL == (p = realloc(ptr, sz)))
+ err(EXIT_FAILURE, "realloc");
+ return(p);
+}
+
void *
xcalloc(size_t num, size_t sz)
{
}
int
-xstrlcats(char *buf, const struct mdoc_node *n, size_t sz)
+xstrlcpys(char *buf, const struct mdoc_node *n, size_t sz)
{
char *p;