equal
deleted
inserted
replaced
|
1 #include "util.h" |
|
2 #include "../str.h" |
|
3 |
|
4 const char *dump_strn (const char *str, ssize_t len) |
|
5 { |
|
6 static char dump_buf[DUMP_STR_COUNT][DUMP_STR_BUF]; |
|
7 static size_t dump_idx = 0; |
|
8 |
|
9 // pick a buffer to use |
|
10 char *buf = dump_buf[dump_idx++]; |
|
11 |
|
12 // cycle |
|
13 if (dump_idx >= DUMP_STR_COUNT) |
|
14 dump_idx = 0; |
|
15 |
|
16 // write the quoted string into the selected buf |
|
17 str_quote(buf, DUMP_STR_BUF, str, len); |
|
18 |
|
19 // ok |
|
20 return buf; |
|
21 } |
|
22 |
|
23 const char *dump_str (const char *str) |
|
24 { |
|
25 return dump_strn(str, -1); |
|
26 } |
|
27 |