On 10/06/2010 08:07 AM, Jim Meyering wrote:

Make write_cb callback's buffer parameter const, like all write-like
functions.
Give a few "char *" parameters the "const" attribute.

Signed-off-by: Jim Meyering<meyer...@redhat.com>
---

It looks like most of hail's interfaces are const-correct,
but one stood out because it provokes a warning when I tried to
pass a const-correct write_cb function to hstor_get from iwhd:

     proxy.c:382: warning: passing argument 4 of 'hstor_get' from \
       incompatible pointer type
     /usr/include/hstor.h:173: note: expected \
       'size_t (*)(void *, size_t, size_t,  void *)' but argument is of type \
       'size_t (*)(const void *, size_t,  size_t,  void *)'

In case you feel comfortable fixing this, here's a patch:


Sorry for not getting back to this; I had hoped to solve some additional problems that cropped up, but didn't have time. So, to forestall further delay,

libtool: compile: gcc -DHAVE_CONFIG_H -I. -I.. -I../include -pthread -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/libxml2 -O2 -Wall -Wshadow -g -MT hutil.lo -MD -MP -MF .deps/hutil.Tpo -c hutil.c -o hutil.o
hutil.c: In function ‘hreq_hdr_push’:
hutil.c:145: warning: assignment discards qualifiers from pointer target type hutil.c:146: warning: assignment discards qualifiers from pointer target type

warnings appear after this patch. When solving these warnings with 'const' markers, it quickly becomes a bit of a rat's nest.

At a minimum, the write_cb callback signature must match libcurl's, which does not use 'const'. I can see this makes sense from libcurl implementation's perspective, even if it does not really match the constness one expects from a foo-get function.

        Jeff



--
To unsubscribe from this list: send the line "unsubscribe hail-devel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to