diff options
Diffstat (limited to 'src/lib/libcrypto/buffer/buf_str.c')
-rw-r--r-- | src/lib/libcrypto/buffer/buf_str.c | 79 |
1 files changed, 0 insertions, 79 deletions
diff --git a/src/lib/libcrypto/buffer/buf_str.c b/src/lib/libcrypto/buffer/buf_str.c deleted file mode 100644 index f7e4c0b966..0000000000 --- a/src/lib/libcrypto/buffer/buf_str.c +++ /dev/null | |||
@@ -1,79 +0,0 @@ | |||
1 | /* $OpenBSD: buf_str.c,v 1.9 2014/07/11 08:44:48 jsing Exp $ */ | ||
2 | /* | ||
3 | * Copyright (c) 2014 Bob Beck | ||
4 | * | ||
5 | * Permission to use, copy, modify, and distribute this software for any | ||
6 | * purpose with or without fee is hereby granted, provided that the above | ||
7 | * copyright notice and this permission notice appear in all copies. | ||
8 | * | ||
9 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
10 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
11 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
12 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
13 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
14 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
15 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
16 | */ | ||
17 | |||
18 | #include <stdlib.h> | ||
19 | #include <stdio.h> | ||
20 | #include <string.h> | ||
21 | |||
22 | #include <openssl/buffer.h> | ||
23 | #include <openssl/err.h> | ||
24 | |||
25 | /* | ||
26 | * XXX these functions accept a NULL arg and return NULL | ||
27 | * when the standard ones do not. we should at an appropriate | ||
28 | * time change these to find the bad callers | ||
29 | */ | ||
30 | |||
31 | char * | ||
32 | BUF_strdup(const char *str) | ||
33 | { | ||
34 | char *ret = NULL; | ||
35 | |||
36 | if (str != NULL) { | ||
37 | if (!(ret = strdup(str))) | ||
38 | BUFerr(BUF_F_BUF_STRDUP, ERR_R_MALLOC_FAILURE); | ||
39 | } | ||
40 | return ret; | ||
41 | } | ||
42 | |||
43 | char * | ||
44 | BUF_strndup(const char *str, size_t siz) | ||
45 | { | ||
46 | char *ret = NULL; | ||
47 | |||
48 | if (str != NULL) { | ||
49 | if (!(ret = strndup(str, siz))) | ||
50 | BUFerr(BUF_F_BUF_STRNDUP, ERR_R_MALLOC_FAILURE); | ||
51 | } | ||
52 | return ret; | ||
53 | } | ||
54 | |||
55 | void * | ||
56 | BUF_memdup(const void *data, size_t siz) | ||
57 | { | ||
58 | void *ret = NULL; | ||
59 | |||
60 | if (data != NULL) { | ||
61 | if (!(ret = malloc(siz))) | ||
62 | BUFerr(BUF_F_BUF_MEMDUP, ERR_R_MALLOC_FAILURE); | ||
63 | else | ||
64 | (void) memcpy(ret, data, siz); | ||
65 | } | ||
66 | return ret; | ||
67 | } | ||
68 | |||
69 | size_t | ||
70 | BUF_strlcpy(char *dst, const char *src, size_t size) | ||
71 | { | ||
72 | return strlcpy(dst, src, size); | ||
73 | } | ||
74 | |||
75 | size_t | ||
76 | BUF_strlcat(char *dst, const char *src, size_t size) | ||
77 | { | ||
78 | return strlcat(dst, src, size); | ||
79 | } | ||