[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r30485 - in gnunet/src: gns gnsrecord include util
From: |
gnunet |
Subject: |
[GNUnet-SVN] r30485 - in gnunet/src: gns gnsrecord include util |
Date: |
Wed, 30 Oct 2013 19:15:48 +0100 |
Author: grothoff
Date: 2013-10-30 19:15:48 +0100 (Wed, 30 Oct 2013)
New Revision: 30485
Modified:
gnunet/src/gns/gnunet-service-gns.c
gnunet/src/gnsrecord/gnsrecord_misc.c
gnunet/src/include/gnunet_strings_lib.h
gnunet/src/util/crypto_hash.c
gnunet/src/util/strings.c
Log:
-simplify utf8_tolower/upper APIs
Modified: gnunet/src/gns/gnunet-service-gns.c
===================================================================
--- gnunet/src/gns/gnunet-service-gns.c 2013-10-30 16:54:08 UTC (rev 30484)
+++ gnunet/src/gns/gnunet-service-gns.c 2013-10-30 18:15:48 UTC (rev 30485)
@@ -758,7 +758,7 @@
GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
return;
}
- GNUNET_STRINGS_utf8_tolower (utf_in, &nameptr);
+ GNUNET_STRINGS_utf8_tolower (utf_in, nameptr);
GNUNET_SERVER_receive_done (client, GNUNET_OK);
clh = GNUNET_new (struct ClientLookupHandle);
Modified: gnunet/src/gnsrecord/gnsrecord_misc.c
===================================================================
--- gnunet/src/gnsrecord/gnsrecord_misc.c 2013-10-30 16:54:08 UTC (rev
30484)
+++ gnunet/src/gnsrecord/gnsrecord_misc.c 2013-10-30 18:15:48 UTC (rev
30485)
@@ -45,10 +45,10 @@
char *
GNUNET_GNSRECORD_string_to_lowercase (const char *src)
{
- GNUNET_assert (NULL != src);
- char *res = strdup (src);
- /* normalize */
- GNUNET_STRINGS_utf8_tolower(src, &res);
+ char *res;
+
+ res = GNUNET_strdup (src);
+ GNUNET_STRINGS_utf8_tolower (src, res);
return res;
}
Modified: gnunet/src/include/gnunet_strings_lib.h
===================================================================
--- gnunet/src/include/gnunet_strings_lib.h 2013-10-30 16:54:08 UTC (rev
30484)
+++ gnunet/src/include/gnunet_strings_lib.h 2013-10-30 18:15:48 UTC (rev
30485)
@@ -153,27 +153,27 @@
/**
- * Convert the utf-8 input string to lowercase
- * Output needs to be allocated appropriately
+ * Convert the utf-8 input string to lower case.
+ * Output needs to be allocated appropriately.
*
* @param input input string
* @param output output buffer
*/
void
-GNUNET_STRINGS_utf8_tolower (const char* input,
- char** output);
+GNUNET_STRINGS_utf8_tolower (const char *input,
+ char *output);
/**
- * Convert the utf-8 input string to lowercase
- * Output needs to be allocated appropriately
+ * Convert the utf-8 input string to upper case.
+ * Output needs to be allocated appropriately.
*
* @param input input string
* @param output output buffer
*/
void
-GNUNET_STRINGS_utf8_toupper (const char* input,
- char** output);
+GNUNET_STRINGS_utf8_toupper (const char *input,
+ char *output);
/**
Modified: gnunet/src/util/crypto_hash.c
===================================================================
--- gnunet/src/util/crypto_hash.c 2013-10-30 16:54:08 UTC (rev 30484)
+++ gnunet/src/util/crypto_hash.c 2013-10-30 18:15:48 UTC (rev 30485)
@@ -274,12 +274,12 @@
int
GNUNET_CRYPTO_hash_from_string2 (const char *enc,
size_t enclen,
- struct GNUNET_HashCode *result)
+ struct GNUNET_HashCode *result)
{
char upper_enc[enclen];
- char* up_ptr = upper_enc;
+ char *up_ptr = upper_enc;
- GNUNET_STRINGS_utf8_toupper(enc, &up_ptr);
+ GNUNET_STRINGS_utf8_toupper (enc, up_ptr);
return GNUNET_STRINGS_string_to_data (upper_enc, enclen,
(unsigned char*) result,
Modified: gnunet/src/util/strings.c
===================================================================
--- gnunet/src/util/strings.c 2013-10-30 16:54:08 UTC (rev 30484)
+++ gnunet/src/util/strings.c 2013-10-30 18:15:48 UTC (rev 30485)
@@ -492,44 +492,46 @@
/**
- * Convert the utf-8 input string to lowercase
- * Output needs to be allocated appropriately
+ * Convert the utf-8 input string to lowercase.
+ * Output needs to be allocated appropriately.
*
* @param input input string
* @param output output buffer
*/
void
-GNUNET_STRINGS_utf8_tolower(const char* input, char** output)
+GNUNET_STRINGS_utf8_tolower (const char *input,
+ char *output)
{
uint8_t *tmp_in;
size_t len;
tmp_in = u8_tolower ((uint8_t*)input, strlen ((char *) input),
NULL, UNINORM_NFD, NULL, &len);
- memcpy(*output, tmp_in, len);
- (*output)[len] = '\0';
+ memcpy(output, tmp_in, len);
+ output[len] = '\0';
free(tmp_in);
}
/**
- * Convert the utf-8 input string to uppercase
- * Output needs to be allocated appropriately
+ * Convert the utf-8 input string to uppercase.
+ * Output needs to be allocated appropriately.
*
* @param input input string
* @param output output buffer
*/
void
-GNUNET_STRINGS_utf8_toupper(const char* input, char** output)
+GNUNET_STRINGS_utf8_toupper(const char *input,
+ char *output)
{
uint8_t *tmp_in;
size_t len;
tmp_in = u8_toupper ((uint8_t*)input, strlen ((char *) input),
NULL, UNINORM_NFD, NULL, &len);
- memcpy(*output, tmp_in, len);
- (*output)[len] = '\0';
- free(tmp_in);
+ memcpy (output, tmp_in, len);
+ output[len] = '\0';
+ free (tmp_in);
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r30485 - in gnunet/src: gns gnsrecord include util,
gnunet <=