libmicrohttpd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[libmicrohttpd] Propose api change


From: flavio.ceolin
Subject: [libmicrohttpd] Propose api change
Date: Sun, 25 Oct 2015 19:07:19 -0200

Hi folks,

I've playing around with microhttpd and i think the function
MHD_get_connection_values() can be easily improved. This function
receives an enum of MHD_ValueKind, so you have to call this function
with a kind per time if you need to get different kind of values.

I do not know how we deal with api changes in this project, but i think
it would be better if instead of receive an enum it receives an unsigne
int, so we could do something like this, MHD_GET_ARGUMENT_KIND |
MHD_HEADER_KIND | ...

Follow the patch (any suggestion is valid :))


Index: src/include/microhttpd.h
===================================================================
--- src/include/microhttpd.h    (revision 36562)
+++ src/include/microhttpd.h    (working copy)
@@ -1786,7 +1786,7 @@
  */
 _MHD_EXTERN int
 MHD_get_connection_values (struct MHD_Connection *connection,
-                           enum MHD_ValueKind kind,
+                           unsigned int kind,
                            MHD_KeyValueIterator iterator, void *iterator_cls);
 
 
Index: src/microhttpd/connection.c
===================================================================
--- src/microhttpd/connection.c (revision 36562)
+++ src/microhttpd/connection.c (working copy)
@@ -125,7 +125,7 @@
  */
 int
 MHD_get_connection_values (struct MHD_Connection *connection,
-                           enum MHD_ValueKind kind,
+                           unsigned int kind,
                            MHD_KeyValueIterator iterator, void *iterator_cls)
 {
   int ret;
@@ -140,7 +140,7 @@
        ret++;
        if ((NULL != iterator) &&
            (MHD_YES != iterator (iterator_cls,
-                                 kind, pos->header, pos->value)))
+                                 (pos->kind & kind), pos->header, pos->value)))
          return ret;
       }
   return ret;

-- 
Flavio Ceolin
Intel Open source Technology Center




reply via email to

[Prev in Thread] Current Thread [Next in Thread]