mirror of
https://gitlab.labs.nic.cz/labs/bird.git
synced 2024-05-11 16:54:54 +00:00
Add lp_strdup function for string duplication on linpool
This commit is contained in:
11
lib/string.h
11
lib/string.h
@ -13,6 +13,8 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <strings.h>
|
#include <strings.h>
|
||||||
|
|
||||||
|
#include "lib/resource.h"
|
||||||
|
|
||||||
int bsprintf(char *str, const char *fmt, ...);
|
int bsprintf(char *str, const char *fmt, ...);
|
||||||
int bvsprintf(char *str, const char *fmt, va_list args);
|
int bvsprintf(char *str, const char *fmt, va_list args);
|
||||||
int bsnprintf(char *str, int size, const char *fmt, ...);
|
int bsnprintf(char *str, int size, const char *fmt, ...);
|
||||||
@ -39,6 +41,15 @@ xstrdup(const char *c)
|
|||||||
return z;
|
return z;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline char *
|
||||||
|
lp_strdup(linpool *lp, const char *c)
|
||||||
|
{
|
||||||
|
size_t l = strlen(c) + 1;
|
||||||
|
char *z = lp_allocu(lp, l);
|
||||||
|
memcpy(z, c, l);
|
||||||
|
return z;
|
||||||
|
}
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
memset32(void *D, u32 val, uint n)
|
memset32(void *D, u32 val, uint n)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user