chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
basic/mount-util: recognize ocfs2 as network fs (#3713)
[elogind.git]
/
src
/
basic
/
string-util.c
diff --git
a/src/basic/string-util.c
b/src/basic/string-util.c
index dfcb29235546d6764cd0e86f5a14edb221e639b8..293a15f9c041cf59f5354829cfdc86b0b0622a20 100644
(file)
--- a/
src/basic/string-util.c
+++ b/
src/basic/string-util.c
@@
-1,5
+1,3
@@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
/***
This file is part of systemd.
/***
This file is part of systemd.
@@
-19,8
+17,15
@@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
+#include <errno.h>
+#include <stdarg.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+
#include "alloc-util.h"
#include "gunicode.h"
#include "alloc-util.h"
#include "gunicode.h"
+#include "macro.h"
#include "string-util.h"
#include "utf8.h"
#include "util.h"
#include "string-util.h"
#include "utf8.h"
#include "util.h"
@@
-356,6
+361,21
@@
int ascii_strcasecmp_n(const char *a, const char *b, size_t n) {
return 0;
}
return 0;
}
+int ascii_strcasecmp_nn(const char *a, size_t n, const char *b, size_t m) {
+ int r;
+
+ r = ascii_strcasecmp_n(a, b, MIN(n, m));
+ if (r != 0)
+ return r;
+
+ if (n < m)
+ return -1;
+ else if (n > m)
+ return 1;
+ else
+ return 0;
+}
+
bool chars_intersect(const char *a, const char *b) {
const char *p;
bool chars_intersect(const char *a, const char *b) {
const char *p;
@@
-457,7
+477,7
@@
char *ellipsize_mem(const char *s, size_t old_length, size_t new_length, unsigne
}
if (k > x) /* last character was wide and went over quota */
}
if (k > x) /* last character was wide and went over quota */
- x
++;
+ x++;
for (j = s + old_length; k < new_length && j > i; ) {
char32_t c;
for (j = s + old_length; k < new_length && j > i; ) {
char32_t c;