diff options
| author | Roy Marples <roy@marples.name> | 2017-03-21 20:16:47 +0000 |
|---|---|---|
| committer | Roy Marples <roy@marples.name> | 2017-03-21 20:16:47 +0000 |
| commit | 5b1a47b93ecabbf6a59be4a7a390197a085dd21c (patch) | |
| tree | a1cc34d9764801e3232d1dce664ca46078933621 /compat | |
| parent | 4d32f169e3c750d757e2adfed47c1cbfc9a3b7a3 (diff) | |
| download | dhcpcd-5b1a47b93ecabbf6a59be4a7a390197a085dd21c.tar.xz | |
Remove the strlcpy compat code and just #define it to snprintf(3).
This is the same and reduces code size.
Diffstat (limited to 'compat')
| -rw-r--r-- | compat/strlcpy.c | 52 | ||||
| -rw-r--r-- | compat/strlcpy.h | 34 |
2 files changed, 0 insertions, 86 deletions
diff --git a/compat/strlcpy.c b/compat/strlcpy.c deleted file mode 100644 index 47776a05..00000000 --- a/compat/strlcpy.c +++ /dev/null @@ -1,52 +0,0 @@ -/* - * dhcpcd - DHCP client daemon - * Copyright (c) 2006-2009 Roy Marples <roy@marples.name> - * All rights reserved - - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include <sys/types.h> - -#include "strlcpy.h" - -size_t -strlcpy(char *dst, const char *src, size_t size) -{ - const char *s = src; - size_t n = size; - - if (n && --n) - do { - if (!(*dst++ = *src++)) - break; - } while (--n); - - if (!n) { - if (size) - *dst = '\0'; - while (*src++); - } - - - return (size_t)(src - s - 1); -} diff --git a/compat/strlcpy.h b/compat/strlcpy.h deleted file mode 100644 index 951390a9..00000000 --- a/compat/strlcpy.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * dhcpcd - DHCP client daemon - * Copyright (c) 2006-2009 Roy Marples <roy@marples.name> - * All rights reserved - - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef STRLCPY_H -#define STRLCPY_H - -#include <sys/types.h> - -size_t strlcpy(char *, const char *, size_t); -#endif |
