From: Christian Grothoff Date: Sun, 3 Apr 2016 19:35:52 +0000 (+0000) Subject: add function for string parameters X-Git-Tag: initial-import-from-subversion-38251~979 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=e0f650cbf41490b3f58476f0696783058798c63d;p=oweals%2Fgnunet.git add function for string parameters --- diff --git a/src/include/gnunet_pq_lib.h b/src/include/gnunet_pq_lib.h index 39c288f5a..8483b72cf 100644 --- a/src/include/gnunet_pq_lib.h +++ b/src/include/gnunet_pq_lib.h @@ -102,6 +102,16 @@ GNUNET_PQ_query_param_fixed_size (const void *ptr, size_t ptr_size); + +/** + * Generate query parameter for a string. + * + * @param ptr pointer to the string query parameter to pass + */ +struct GNUNET_PQ_QueryParam +GNUNET_PQ_query_param_string (const char *ptr); + + /** * Generate fixed-size query parameter with size determined * by variable type. diff --git a/src/pq/pq_query_helper.c b/src/pq/pq_query_helper.c index d284822c2..d80a3d99a 100644 --- a/src/pq/pq_query_helper.c +++ b/src/pq/pq_query_helper.c @@ -75,6 +75,18 @@ GNUNET_PQ_query_param_fixed_size (const void *ptr, } +/** + * Generate query parameter for a string. + * + * @param ptr pointer to the string query parameter to pass + */ +struct GNUNET_PQ_QueryParam +GNUNET_PQ_query_param_string (const char *ptr) +{ + return GNUNET_PQ_query_param_fixed_size (ptr, strlen (ptr)); +} + + /** * Function called to convert input argument into SQL parameters. * @@ -254,7 +266,7 @@ GNUNET_PQ_query_param_uint64 (const uint64_t *x) * @param scratch_length number of entries left in @a scratch * @return -1 on error, number of offsets used in @a scratch otherwise */ -static int +static int qconv_rsa_public_key (void *cls, const void *data, size_t data_len,