Merge lp://qastaging/~wiml-omni/libdrizzle/misc into lp://qastaging/libdrizzle

Proposed by Wim Lewis
Status: Merged
Approved by: Andrew Hutchings
Approved revision: 115
Merged at revision: 114
Proposed branch: lp://qastaging/~wiml-omni/libdrizzle/misc
Merge into: lp://qastaging/libdrizzle
Diff against target: 378 lines (+82/-89)
8 files modified
libdrizzle-5.1/statement.h (+1/-1)
libdrizzle/binlog.cc (+1/-0)
libdrizzle/common.h (+1/-0)
libdrizzle/conn.cc (+62/-84)
libdrizzle/conn_uds.cc (+0/-1)
libdrizzle/field.cc (+2/-0)
libdrizzle/statement_local.h (+1/-1)
libdrizzle/statement_param.cc (+14/-2)
To merge this branch: bzr merge lp://qastaging/~wiml-omni/libdrizzle/misc
Reviewer Review Type Date Requested Status
Andrew Hutchings Approve
Review via email: mp+160736@code.qastaging.launchpad.net

Description of the change

Miscellaneous improvements I have made while working with the library.

To post a comment you must log in.
Revision history for this message
Andrew Hutchings (linuxjedi) wrote :

"#if defined(EWOULDBLOCK) && (EWOULDBLOCK != EAGAIN)" could probably remove the "(EWOULDBLOCK != EAGAIN)" bit because you are removing the thing that makes them equal. But it should work fine anyway.

Thanks for the cleanups.

review: Approve
Revision history for this message
Wim Lewis (wiml-omni) wrote :

I was thinking of the case where the system header helpfully #defines EWOULDBLOCK to EAGAIN (or the reverse) --- (in fact, checking it just now, sys/errno.h on MacOSX does exactly that :) )

Revision history for this message
Andrew Hutchings (linuxjedi) wrote :

ah, cool. Nice catch then :)

Revision history for this message
Brian Aker (brianaker) wrote :
Download full text (12.0 KiB)

Why not use cinttypes?

It would be better to do this as the first include. inttypes is a bit annoying because whatever calls it determines its behavior.

On Apr 24, 2013, at 11:11 AM, Wim Lewis <email address hidden> wrote:

> Wim Lewis has proposed merging lp:~wiml-omni/libdrizzle/misc into lp:libdrizzle.
>
> Requested reviews:
> Drizzle Trunk (drizzle-trunk)
>
> For more details, see:
> https://code.launchpad.net/~wiml-omni/libdrizzle/misc/+merge/160736
>
> Miscellaneous improvements I have made while working with the library.
> --
> https://code.launchpad.net/~wiml-omni/libdrizzle/misc/+merge/160736
> Your team Drizzle Trunk is requested to review the proposed merge of lp:~wiml-omni/libdrizzle/misc into lp:libdrizzle.
> === modified file 'libdrizzle-5.1/statement.h'
> --- libdrizzle-5.1/statement.h 2013-01-27 11:55:48 +0000
> +++ libdrizzle-5.1/statement.h 2013-04-24 18:10:30 +0000
> @@ -96,7 +96,7 @@
> drizzle_return_t drizzle_stmt_set_float(drizzle_stmt_st *stmt, uint16_t param_num, float value);
>
> DRIZZLE_API
> -drizzle_return_t drizzle_stmt_set_string(drizzle_stmt_st *stmt, uint16_t param_num, char *value, size_t length);
> +drizzle_return_t drizzle_stmt_set_string(drizzle_stmt_st *stmt, uint16_t param_num, const char *value, size_t length);
>
> DRIZZLE_API
> drizzle_return_t drizzle_stmt_set_null(drizzle_stmt_st *stmt, uint16_t param_num);
>
> === modified file 'libdrizzle/binlog.cc'
> --- libdrizzle/binlog.cc 2013-03-06 18:09:39 +0000
> +++ libdrizzle/binlog.cc 2013-04-24 18:10:30 +0000
> @@ -39,6 +39,7 @@
> #include "libdrizzle/common.h"
>
> #include <zlib.h>
> +#include <inttypes.h>
>
> drizzle_binlog_st *drizzle_binlog_init(drizzle_st *con,
> drizzle_binlog_fn *binlog_fn,
>
> === modified file 'libdrizzle/common.h'
> --- libdrizzle/common.h 2013-01-27 11:55:48 +0000
> +++ libdrizzle/common.h 2013-04-24 18:10:30 +0000
> @@ -76,6 +76,7 @@
>
> #include <stddef.h>
> #include <stdarg.h>
> +#include <stdint.h>
> #include <stdio.h>
> #include <stdlib.h>
> #include <string.h>
>
> === modified file 'libdrizzle/conn.cc'
> --- libdrizzle/conn.cc 2013-03-11 17:33:00 +0000
> +++ libdrizzle/conn.cc 2013-04-24 18:10:30 +0000
> @@ -45,34 +45,10 @@
> #include "config.h"
> #include "libdrizzle/common.h"
>
> -#ifndef SOCK_CLOEXEC
> -# define SOCK_CLOEXEC 0
> -#endif
> -
> -#ifndef SOCK_NONBLOCK
> -# define SOCK_NONBLOCK 0
> -#endif
> -
> -#ifndef FD_CLOEXEC
> -# define FD_CLOEXEC 0
> -#endif
> -
> -#ifndef F_GETFD
> -# define F_GETFD 0
> -#endif
> -
> -#ifndef MSG_DONTWAIT
> -# define MSG_DONTWAIT 0
> -#endif
> -
> #ifndef MSG_NOSIGNAL
> # define MSG_NOSIGNAL 0
> #endif
>
> -#ifndef EWOULDBLOCK
> -# define EWOULDBLOCK EAGAIN
> -#endif
> -
> #include <cerrno>
>
> /**
> @@ -1044,16 +1020,16 @@
>
> {
> int type= con->addrinfo_next->ai_socktype;
> - if (SOCK_CLOEXEC)
> - {
> - type|= SOCK_CLOEXEC;
> - }
> -
> - if (SOCK_NONBLOCK)
> - {
> - type|= SOCK_NONBLOCK;
> - }
> -
> +
> + /* Linuxisms to set some fd flags at the same time as creating the socket. */
> +#ifdef SOCK_CLOEXEC
> + type|= SOCK_CLOEXEC;
> +#endif
> +
...

Revision history for this message
Wim Lewis (wiml-omni) wrote :

You're right, <cinttypes> would be better here. (I'm mostly a C, not C++, programmer.)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches

to all changes: