projects
/
darkstat-debian
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge tag 'upstream/3.0.717'
[darkstat-debian]
/
str.c
diff --git
a/str.c
b/str.c
index
8092666
..
852a24d
100644
(file)
--- a/
str.c
+++ b/
str.c
@@
-16,14
+16,15
@@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
+#include "conv.h"
+#include "err.h"
+#include "str.h"
+
#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h> /* for uint32_t on Linux and OS X */
#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h> /* for uint32_t on Linux and OS X */
-
-#include "conv.h"
-#include "err.h"
-#include "str.h"
+#include <unistd.h>
#define INITIAL_LEN 1024
#define INITIAL_LEN 1024
@@
-105,7
+106,8
@@
static void
str_append_u32(struct str *s, const uint32_t i, const int mod_sep)
{
char out[I32_MAXLEN];
str_append_u32(struct str *s, const uint32_t i, const int mod_sep)
{
char out[I32_MAXLEN];
- int pos, len;
+ int pos;
+ unsigned int len;
uint32_t rem, next;
if (i == 0) {
uint32_t rem, next;
if (i == 0) {
@@
-148,7
+150,8
@@
static void
str_append_u64(struct str *s, const uint64_t i, const int mod_sep)
{
char out[I64_MAXLEN];
str_append_u64(struct str *s, const uint64_t i, const int mod_sep)
{
char out[I64_MAXLEN];
- int pos, len;
+ int pos;
+ unsigned int len;
uint64_t rem, next;
uint32_t rem32, next32;
uint64_t rem, next;
uint32_t rem32, next32;
@@
-224,9
+227,7
@@
str_append_hex8(struct str *s, const uint8_t b)
*
* %x is equivalent to %02x and expects a uint8_t
*/
*
* %x is equivalent to %02x and expects a uint8_t
*/
-static void
-str_vappendf(struct str *s, const char *format, va_list va)
-{
+void str_vappendf(struct str *s, const char *format, va_list va) {
size_t pos, len;
len = strlen(format);
size_t pos, len;
len = strlen(format);
@@
-354,4
+355,12
@@
length_of_time(const time_t t)
return buf;
}
return buf;
}
+ssize_t str_write(const struct str * const buf, const int fd) {
+ return write(fd, buf->buf, buf->len);
+}
+
+size_t str_len(const struct str * const buf) {
+ return buf->len;
+}
+
/* vim:set ts=3 sw=3 tw=78 expandtab: */
/* vim:set ts=3 sw=3 tw=78 expandtab: */