summaryrefslogtreecommitdiff
path: root/src/basic/escape.c
diff options
context:
space:
mode:
authorSven Eden <yamakuzure@gmx.net>2017-04-27 11:30:28 +0200
committerSven Eden <yamakuzure@gmx.net>2017-05-17 15:22:16 +0200
commit66ecc207e203db5434610395cd04c40ae8727b58 (patch)
tree4808a261a6e58dcdbc9e8616f18cce65b2a49b83 /src/basic/escape.c
parent4f8a2329ef626675895974d53a6afad68a0d255a (diff)
Prep v229: Add missing fixes from upstream [1/6] src/basic
Diffstat (limited to 'src/basic/escape.c')
-rw-r--r--src/basic/escape.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/basic/escape.c b/src/basic/escape.c
index 9dbfa6d6e..2e483880c 100644
--- a/src/basic/escape.c
+++ b/src/basic/escape.c
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
/***
This file is part of systemd.
@@ -19,12 +17,15 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
+#include <errno.h>
+#include <stdlib.h>
+#include <string.h>
+
#include "alloc-util.h"
#include "escape.h"
#include "hexdecoct.h"
-#include "string-util.h"
+#include "macro.h"
#include "utf8.h"
-#include "util.h"
size_t cescape_char(char c, char *buf) {
char * buf_old = buf;
@@ -116,7 +117,7 @@ char *cescape(const char *s) {
return cescape_length(s, strlen(s));
}
-int cunescape_one(const char *p, size_t length, uint32_t *ret, bool *eight_bit) {
+int cunescape_one(const char *p, size_t length, char32_t *ret, bool *eight_bit) {
int r = 1;
assert(p);
@@ -227,7 +228,7 @@ int cunescape_one(const char *p, size_t length, uint32_t *ret, bool *eight_bit)
int a[8];
unsigned i;
- uint32_t c;
+ char32_t c;
if (length != (size_t) -1 && length < 9)
return -EINVAL;
@@ -264,7 +265,7 @@ int cunescape_one(const char *p, size_t length, uint32_t *ret, bool *eight_bit)
case '7': {
/* octal encoding */
int a, b, c;
- uint32_t m;
+ char32_t m;
if (length != (size_t) -1 && length < 3)
return -EINVAL;
@@ -324,8 +325,8 @@ int cunescape_length_with_prefix(const char *s, size_t length, const char *prefi
for (f = s, t = r + pl; f < s + length; f++) {
size_t remaining;
- uint32_t u;
bool eight_bit = false;
+ char32_t u;
int k;
remaining = s + length - f;