[riot-notifications] [RIOT-OS/RIOT] uri_parser: provide function to split query (#16695)

benpicco notifications at github.com
Sun Aug 1 21:09:25 CEST 2021


@benpicco commented on this pull request.



> + *                         Must not be NULL and all zero-valued on call. Will be
+ *                         filled with the name-value-pairs in
+ *                         uri_parser_result_t::query of @p uri_parsed. If the
+ *                         number of query parameters in @p uri_parsed exceeds
+ *                         @p params_len, the list will be truncated and the
+ *                         function returns -2.
+ * @param[in] params_len   The length of @p params
+ *
+ * @return  number of filled entries in @p params on success. Might be 0 if
+ *          uri_parser_result_t::query is NULL.
+ * @return  -1 on parsing error.
+ * @return  -2 when the number of query parameters exceeds @p params_len.
+ *          In that case, the array is filled with the first @p params_len
+ *          name-value-pairs in uri_parser_result_t::query of @p uri_parsed.
+ */
+int uri_parser_split_query(const uri_parser_result_t *uri_parsed,

Why use a `uri_parser_result_t *` here when you are only interested in the `query` element?
This function could be more generic: 
```suggestion
int uri_parser_split_query(const char *query, size_t query_len,
```

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/16695#pullrequestreview-719690153
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20210801/95fcbec1/attachment.htm>


More information about the notifications mailing list