apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alex Dubov <oa...@yahoo.com>
Subject Re: [PATCH]: improved error reporting for apr_dbd_mysql.c - correct version
Date Mon, 29 May 2006 07:21:21 GMT
> I understand. However, this API is primarily a C
> API, so most people
> will associate %s with a zero terminated string.
> Maybe having a %b, for
> blob, would help?
Of course, letter is not important at all. But the
data type is.
> I think this would actually be the correct approach.
> Something like:
> typedef struct apr_dbd_blob apr_dbd_blob_t;
> struct apr_dbd_blob {
>     apr_size_t length;
>     char       *data[];
> };
I tried to find something similar in apr, but failed.
Basically, you are proposing to use libc's "struct
iovec", may be in apr branded fashion. I don't like it
because it requires two allocations (one for struct
and other for data). On the other hand, "inline"
arrays are quite popular in the linux kernel and
people seem to like them, though linux often uses
definitions like:
struct { int len; char data[1]; }
(because of C90 compliance). C99 allows flexible array
members, which I used.

Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 

View raw message