diff options
author | Kay Sievers <kay.sievers@vrfy.org> | 2011-10-06 01:10:59 +0200 |
---|---|---|
committer | Kay Sievers <kay.sievers@vrfy.org> | 2011-10-06 01:10:59 +0200 |
commit | 0bbe8838e75bf97792d61b33f8592a32f1fc8bd4 (patch) | |
tree | ed9c94996deef6d333599c022298828427b3d1cd /libudev | |
parent | 289a1821a4a7636ce42a6c7adc3a9bb49421a5ea (diff) |
libudev: export udev_util_encode_string()
Diffstat (limited to 'libudev')
-rw-r--r-- | libudev/docs/libudev-docs.xml | 3 | ||||
-rw-r--r-- | libudev/docs/libudev-sections.txt | 5 | ||||
-rw-r--r-- | libudev/libudev-private.h | 5 | ||||
-rw-r--r-- | libudev/libudev-util.c | 17 | ||||
-rw-r--r-- | libudev/libudev.h | 10 |
5 files changed, 29 insertions, 11 deletions
diff --git a/libudev/docs/libudev-docs.xml b/libudev/docs/libudev-docs.xml index f470916700..b7feb45529 100644 --- a/libudev/docs/libudev-docs.xml +++ b/libudev/docs/libudev-docs.xml @@ -9,7 +9,7 @@ <title>libudev Reference Manual</title> <releaseinfo>for libudev version &version;</releaseinfo> <copyright> - <year>2009-2010</year> + <year>2009-2011</year> <holder>Kay Sievers <kay.sievers@vrfy.org></holder> </copyright> </bookinfo> @@ -22,6 +22,7 @@ <xi:include href="xml/libudev-monitor.xml"/> <xi:include href="xml/libudev-enumerate.xml"/> <xi:include href="xml/libudev-queue.xml"/> + <xi:include href="xml/libudev-util.xml"/> </chapter> <index id="api-index-full"> diff --git a/libudev/docs/libudev-sections.txt b/libudev/docs/libudev-sections.txt index a686c4558e..15c3e934b5 100644 --- a/libudev/docs/libudev-sections.txt +++ b/libudev/docs/libudev-sections.txt @@ -120,3 +120,8 @@ udev_queue_get_kernel_seqnum udev_queue_get_udev_seqnum </SECTION> +<SECTION> +<FILE>libudev-util</FILE> +<TITLE>udev_util</TITLE> +udev_util_encode_string +</SECTION> diff --git a/libudev/libudev-private.h b/libudev/libudev-private.h index 1bcd2e3236..ffc82cbc6d 100644 --- a/libudev/libudev-private.h +++ b/libudev/libudev-private.h @@ -181,9 +181,8 @@ size_t util_strpcpy(char **dest, size_t size, const char *src); size_t util_strpcpyl(char **dest, size_t size, const char *src, ...) __attribute__((sentinel)); size_t util_strscpy(char *dest, size_t size, const char *src); size_t util_strscpyl(char *dest, size_t size, const char *src, ...) __attribute__((sentinel)); -int udev_util_replace_whitespace(const char *str, char *to, size_t len); -int udev_util_replace_chars(char *str, const char *white); -int udev_util_encode_string(const char *str, char *str_enc, size_t len); +int util_replace_whitespace(const char *str, char *to, size_t len); +int util_replace_chars(char *str, const char *white); unsigned int util_string_hash32(const char *key); uint64_t util_string_bloom64(const char *str); diff --git a/libudev/libudev-util.c b/libudev/libudev-util.c index a600b0a881..e08349e0fa 100644 --- a/libudev/libudev-util.c +++ b/libudev/libudev-util.c @@ -1,7 +1,7 @@ /* * libudev - interface to udev device information * - * Copyright (C) 2008-2009 Kay Sievers <kay.sievers@vrfy.org> + * Copyright (C) 2008-2011 Kay Sievers <kay.sievers@vrfy.org> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -24,6 +24,11 @@ #include "libudev.h" #include "libudev-private.h" +/** + * SECTION:libudev-util + * @short_description: utils + */ + ssize_t util_get_sys_core_link_value(struct udev *udev, const char *slink, const char *syspath, char *value, size_t size) { char path[UTIL_PATH_SIZE]; @@ -342,7 +347,7 @@ static int utf8_encoded_valid_unichar(const char *str) return len; } -int udev_util_replace_whitespace(const char *str, char *to, size_t len) +int util_replace_whitespace(const char *str, char *to, size_t len) { size_t i, j; @@ -382,7 +387,7 @@ static int is_whitelisted(char c, const char *white) } /* allow chars in whitelist, plain ascii, hex-escaping and valid utf8 */ -int udev_util_replace_chars(char *str, const char *white) +int util_replace_chars(char *str, const char *white) { size_t i = 0; int replaced = 0; @@ -425,18 +430,18 @@ int udev_util_replace_chars(char *str, const char *white) } /** - * util_encode_string: + * udev_util_encode_string: * @str: input string to be encoded * @str_enc: output string to store the encoded input string * @len: maximum size of the output string, which may be * four times as long as the input string * * Encode all potentially unsafe characters of a string to the - * corresponding hex value prefixed by '\x'. + * corresponding 2 char hex value prefixed by '\x'. * * Returns: 0 if the entire string was copied, non-zero otherwise. **/ -int udev_util_encode_string(const char *str, char *str_enc, size_t len) +UDEV_EXPORT int udev_util_encode_string(const char *str, char *str_enc, size_t len) { size_t i, j; diff --git a/libudev/libudev.h b/libudev/libudev.h index 47b56bb17a..497f752fca 100644 --- a/libudev/libudev.h +++ b/libudev/libudev.h @@ -1,7 +1,7 @@ /* * libudev - interface to udev device information * - * Copyright (C) 2008-2010 Kay Sievers <kay.sievers@vrfy.org> + * Copyright (C) 2008-2011 Kay Sievers <kay.sievers@vrfy.org> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -174,6 +174,14 @@ int udev_queue_get_seqnum_sequence_is_finished(struct udev_queue *udev_queue, unsigned long long int start, unsigned long long int end); struct udev_list_entry *udev_queue_get_queued_list_entry(struct udev_queue *udev_queue); +/* + * udev_util + * + * udev specific utilities + */ +int udev_util_encode_string(const char *str, char *str_enc, size_t len); + + #ifdef __cplusplus } /* extern "C" */ #endif |