summaryrefslogtreecommitdiffstats
path: root/libblkid/src/probe.c
diff options
context:
space:
mode:
authorKarel Zak2014-08-25 15:31:53 +0200
committerKarel Zak2014-08-25 15:31:53 +0200
commit22e9e9c8e95e609a20f24ec60fcd706f601e0be7 (patch)
tree4d3c6af7447947e819158327eb4eeceed5b47a0d /libblkid/src/probe.c
parentlibfdisk: basic fdisk_dump_* functions (diff)
downloadkernel-qcow2-util-linux-22e9e9c8e95e609a20f24ec60fcd706f601e0be7.tar.gz
kernel-qcow2-util-linux-22e9e9c8e95e609a20f24ec60fcd706f601e0be7.tar.xz
kernel-qcow2-util-linux-22e9e9c8e95e609a20f24ec60fcd706f601e0be7.zip
libblkid: move string trim function to strutils.h
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libblkid/src/probe.c')
-rw-r--r--libblkid/src/probe.c23
1 files changed, 4 insertions, 19 deletions
diff --git a/libblkid/src/probe.c b/libblkid/src/probe.c
index b1eddd628..4fea3ccb4 100644
--- a/libblkid/src/probe.c
+++ b/libblkid/src/probe.c
@@ -111,6 +111,7 @@
#include "blkidP.h"
#include "all-io.h"
#include "sysfs.h"
+#include "strutils.h"
/* chains */
extern const struct blkid_chaindrv superblocks_drv;
@@ -1717,14 +1718,7 @@ int blkid_uuid_is_empty(const unsigned char *buf, size_t len)
*/
size_t blkid_rtrim_whitespace(unsigned char *str)
{
- size_t i = strlen((char *) str);
-
- while (i--) {
- if (!isspace(str[i]))
- break;
- }
- str[++i] = '\0';
- return i;
+ return rtrim_whitespace(str);
}
/* Removes whitespace from the left-hand side of a string.
@@ -1733,18 +1727,9 @@ size_t blkid_rtrim_whitespace(unsigned char *str)
*/
size_t blkid_ltrim_whitespace(unsigned char *str)
{
- size_t len;
- unsigned char *p;
-
- for (p = str; p && isspace(*p); p++);
-
- len = strlen((char *) p);
-
- if (len && p > str)
- memmove(str, p, len + 1);
-
- return len;
+ return ltrim_whitespace(str);
}
+
/*
* Some mkfs-like utils wipe some parts (usually begin) of the device.
* For example LVM (pvcreate) or mkswap(8). This information could be used