berns 4.2.0 → 4.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/{README.org → README.md} +98 -90
- data/ext/berns/berns.c +587 -581
- data/ext/berns/extconf.rb +5 -0
- data/ext/berns/strxcat.c +20 -0
- data/ext/berns/strxcat.h +11 -0
- data/ext/berns/strxcpy.c +50 -0
- data/ext/berns/strxcpy.h +32 -0
- data/ext/berns/strxempty.c +9 -0
- data/ext/berns/strxempty.h +9 -0
- data/ext/berns/strxfree.c +6 -0
- data/ext/berns/strxfree.h +9 -0
- data/ext/berns/strxnew.c +8 -0
- data/ext/berns/strxnew.h +11 -0
- data/ext/berns/strxresize.c +6 -0
- data/ext/berns/strxresize.h +10 -0
- data/lib/berns/berns.bundle +0 -0
- data/lib/berns/version.rb +1 -1
- metadata +17 -5
data/ext/berns/extconf.rb
CHANGED
data/ext/berns/strxcat.c
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
#include <stdarg.h>
|
2
|
+
|
3
|
+
#include "strxcat.h"
|
4
|
+
#include "strxcpy.h"
|
5
|
+
|
6
|
+
char * strxcat(char *destination, size_t size, ...) {
|
7
|
+
va_list sources;
|
8
|
+
va_start(sources, size);
|
9
|
+
|
10
|
+
while(size > 1) {
|
11
|
+
char *source = va_arg(sources, char*);
|
12
|
+
size_t position = strxcpy(destination, source, size);
|
13
|
+
destination += position;
|
14
|
+
size -= position;
|
15
|
+
}
|
16
|
+
|
17
|
+
va_end(sources);
|
18
|
+
|
19
|
+
return destination;
|
20
|
+
}
|
data/ext/berns/strxcat.h
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
#ifndef STRXCAT_H
|
2
|
+
#define STRXCAT_H
|
3
|
+
#include <stddef.h>
|
4
|
+
|
5
|
+
/*
|
6
|
+
* Concatenate an arbitrary number of char* into a destination. Copies at most
|
7
|
+
* size characters into the destination.
|
8
|
+
*/
|
9
|
+
extern char * strxcat(char *destination, size_t size, ...);
|
10
|
+
|
11
|
+
#endif
|
data/ext/berns/strxcpy.c
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
#include "strxcpy.h"
|
2
|
+
|
3
|
+
/* The below is simply OpenBSD's strlcpy function, renamed so it can be vendored. */
|
4
|
+
|
5
|
+
/* $OpenBSD: strlcpy.c,v 1.16 2019/01/25 00:19:25 millert Exp $ */
|
6
|
+
|
7
|
+
/*
|
8
|
+
* Copyright (c) 1998, 2015 Todd C. Miller <millert@openbsd.org>
|
9
|
+
*
|
10
|
+
* Permission to use, copy, modify, and distribute this software for any
|
11
|
+
* purpose with or without fee is hereby granted, provided that the above
|
12
|
+
* copyright notice and this permission notice appear in all copies.
|
13
|
+
*
|
14
|
+
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
15
|
+
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
16
|
+
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
17
|
+
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
18
|
+
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
19
|
+
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
20
|
+
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
21
|
+
*/
|
22
|
+
|
23
|
+
/*
|
24
|
+
* Copy string src to buffer dst of size dsize. At most dsize-1 chars will be
|
25
|
+
* copied. Always NUL terminates (unless dsize == 0). Returns strlen(src); if
|
26
|
+
* retval >= dsize, truncation occurred.
|
27
|
+
*/
|
28
|
+
size_t strxcpy(char *dst, const char *src, size_t dsize) {
|
29
|
+
const char *osrc = src;
|
30
|
+
size_t nleft = dsize;
|
31
|
+
|
32
|
+
/* Copy as many bytes as will fit. */
|
33
|
+
if (nleft != 0) {
|
34
|
+
while (--nleft != 0) {
|
35
|
+
if ((*dst++ = *src++) == '\0') {
|
36
|
+
break;
|
37
|
+
}
|
38
|
+
}
|
39
|
+
}
|
40
|
+
|
41
|
+
/* Not enough room in dst, add NUL and traverse rest of src. */
|
42
|
+
if (nleft == 0) {
|
43
|
+
if (dsize != 0)
|
44
|
+
*dst = '\0'; /* NUL-terminate dst */
|
45
|
+
while (*src++)
|
46
|
+
;
|
47
|
+
}
|
48
|
+
|
49
|
+
return(src - osrc - 1); /* count does not include NUL */
|
50
|
+
}
|
data/ext/berns/strxcpy.h
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
#ifndef STRXCPY_H
|
2
|
+
#define STRXCPY_H
|
3
|
+
#include <stddef.h>
|
4
|
+
|
5
|
+
/* The below is simply OpenBSD's strlcpy function, renamed so it can be vendored. */
|
6
|
+
|
7
|
+
/* $OpenBSD: strlcpy.c,v 1.16 2019/01/25 00:19:25 millert Exp $ */
|
8
|
+
|
9
|
+
/*
|
10
|
+
* Copyright (c) 1998, 2015 Todd C. Miller <millert@openbsd.org>
|
11
|
+
*
|
12
|
+
* Permission to use, copy, modify, and distribute this software for any
|
13
|
+
* purpose with or without fee is hereby granted, provided that the above
|
14
|
+
* copyright notice and this permission notice appear in all copies.
|
15
|
+
*
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
17
|
+
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
18
|
+
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
19
|
+
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
20
|
+
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
21
|
+
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
22
|
+
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
23
|
+
*/
|
24
|
+
|
25
|
+
/*
|
26
|
+
* Copy string src to buffer dst of size dsize. At most dsize-1 chars will be
|
27
|
+
* copied. Always NUL terminates (unless dsize == 0). Returns strlen(src); if
|
28
|
+
* retval >= dsize, truncation occurred.
|
29
|
+
*/
|
30
|
+
extern size_t strxcpy(char *dst, const char *src, size_t dsize);
|
31
|
+
|
32
|
+
#endif
|
data/ext/berns/strxnew.c
ADDED
data/ext/berns/strxnew.h
ADDED
data/lib/berns/berns.bundle
CHANGED
Binary file
|
data/lib/berns/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: berns
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Taylor Beck
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2023-07-11 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: A utility library for generating HTML strings.
|
15
15
|
email:
|
@@ -21,11 +21,23 @@ extensions:
|
|
21
21
|
extra_rdoc_files: []
|
22
22
|
files:
|
23
23
|
- LICENSE.txt
|
24
|
-
- README.
|
24
|
+
- README.md
|
25
25
|
- ext/berns/berns.c
|
26
26
|
- ext/berns/extconf.rb
|
27
27
|
- ext/berns/hescape.c
|
28
28
|
- ext/berns/hescape.h
|
29
|
+
- ext/berns/strxcat.c
|
30
|
+
- ext/berns/strxcat.h
|
31
|
+
- ext/berns/strxcpy.c
|
32
|
+
- ext/berns/strxcpy.h
|
33
|
+
- ext/berns/strxempty.c
|
34
|
+
- ext/berns/strxempty.h
|
35
|
+
- ext/berns/strxfree.c
|
36
|
+
- ext/berns/strxfree.h
|
37
|
+
- ext/berns/strxnew.c
|
38
|
+
- ext/berns/strxnew.h
|
39
|
+
- ext/berns/strxresize.c
|
40
|
+
- ext/berns/strxresize.h
|
29
41
|
- lib/berns.rb
|
30
42
|
- lib/berns/berns.bundle
|
31
43
|
- lib/berns/builder.rb
|
@@ -35,7 +47,7 @@ licenses:
|
|
35
47
|
- MIT
|
36
48
|
metadata:
|
37
49
|
bug_tracker_uri: https://github.com/evanleck/berns/issues
|
38
|
-
changelog_uri: https://github.com/evanleck/berns/blob/main/CHANGELOG.
|
50
|
+
changelog_uri: https://github.com/evanleck/berns/blob/main/CHANGELOG.md
|
39
51
|
homepage_uri: https://github.com/evanleck/berns
|
40
52
|
rubygems_mfa_required: 'true'
|
41
53
|
source_code_uri: https://github.com/evanleck/berns
|
@@ -54,7 +66,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
54
66
|
- !ruby/object:Gem::Version
|
55
67
|
version: '2.0'
|
56
68
|
requirements: []
|
57
|
-
rubygems_version: 3.
|
69
|
+
rubygems_version: 3.4.10
|
58
70
|
signing_key:
|
59
71
|
specification_version: 4
|
60
72
|
summary: A utility library for generating HTML strings.
|