null+****@clear*****
null+****@clear*****
2011年 12月 14日 (水) 19:02:05 JST
Yoji SHIDARA 2011-12-14 10:02:05 +0000 (Wed, 14 Dec 2011) New Revision: 877d00aa114e3b10dad1c74053058c7bda62913b Log: use #ifdef instead of #if Modified files: lib/ctx.c lib/output.c lib/ql.h Modified: lib/ctx.c (+3 -3) =================================================================== --- lib/ctx.c 2011-12-14 09:29:40 +0000 (565b76e) +++ lib/ctx.c 2011-12-14 10:02:05 +0000 (ff42ef6) @@ -392,7 +392,7 @@ grn_ctx_loader_clear(grn_ctx *ctx) #define IMPL_SIZE ((sizeof(struct _grn_ctx_impl) + (grn_pagesize - 1)) & ~(grn_pagesize - 1)) -#if HAVE_MESSAGE_PACK +#ifdef HAVE_MESSAGE_PACK static inline int grn_msgpack_buffer_write(void* data, const char* buf, unsigned int len) { grn_ctx *ctx = (grn_ctx *)data; @@ -486,7 +486,7 @@ grn_ctx_impl_init(grn_ctx *ctx) grn_loader_init(&ctx->impl->loader); ctx->impl->plugin_path = NULL; -#if HAVE_MESSAGE_PACK +#ifdef HAVE_MESSAGE_PACK msgpack_packer_init(&ctx->impl->msgpacker, ctx, grn_msgpack_buffer_write); #endif } @@ -1101,7 +1101,7 @@ get_content_mime_type(grn_ctx *ctx, const char *p, const char *pe) ctx->impl->mime_type = "image/jpeg"; } break; -#if HAVE_MESSAGE_PACK +#ifdef HAVE_MESSAGE_PACK case 'm' : if (p + 7 == pe && !memcmp(p, "msgpack", 7)) { ctx->impl->output_type = GRN_CONTENT_MSGPACK; Modified: lib/output.c (+11 -11) =================================================================== --- lib/output.c 2011-12-14 09:29:40 +0000 (cdc7db2) +++ lib/output.c 2011-12-14 10:02:05 +0000 (cff6925) @@ -80,7 +80,7 @@ grn_output_array_open(grn_ctx *ctx, grn_obj *outbuf, grn_content_type output_typ if (DEPTH > 2) { GRN_TEXT_PUTS(ctx, outbuf, "[\t"); } break; case GRN_CONTENT_MSGPACK : -#if HAVE_MESSAGE_PACK +#ifdef HAVE_MESSAGE_PACK msgpack_pack_array(&ctx->impl->msgpacker, nelements); #endif break; @@ -141,7 +141,7 @@ grn_output_map_open(grn_ctx *ctx, grn_obj *outbuf, grn_content_type output_type, if (DEPTH > 2) { GRN_TEXT_PUTS(ctx, outbuf, "{\t"); } break; case GRN_CONTENT_MSGPACK : -#if HAVE_MESSAGE_PACK +#ifdef HAVE_MESSAGE_PACK msgpack_pack_map(&ctx->impl->msgpacker, nelements / 2); #endif break; @@ -200,7 +200,7 @@ grn_output_int32(grn_ctx *ctx, grn_obj *outbuf, grn_content_type output_type, in GRN_TEXT_PUTS(ctx, outbuf, "</INT>"); break; case GRN_CONTENT_MSGPACK : -#if HAVE_MESSAGE_PACK +#ifdef HAVE_MESSAGE_PACK msgpack_pack_int32(&ctx->impl->msgpacker, value); #endif break; @@ -227,7 +227,7 @@ grn_output_int64(grn_ctx *ctx, grn_obj *outbuf, grn_content_type output_type, in GRN_TEXT_PUTS(ctx, outbuf, "</INT>"); break; case GRN_CONTENT_MSGPACK : -#if HAVE_MESSAGE_PACK +#ifdef HAVE_MESSAGE_PACK msgpack_pack_int64(&ctx->impl->msgpacker, value); #endif break; @@ -254,7 +254,7 @@ grn_output_uint64(grn_ctx *ctx, grn_obj *outbuf, grn_content_type output_type, i GRN_TEXT_PUTS(ctx, outbuf, "</INT>"); break; case GRN_CONTENT_MSGPACK : -#if HAVE_MESSAGE_PACK +#ifdef HAVE_MESSAGE_PACK msgpack_pack_uint64(&ctx->impl->msgpacker, value); #endif break; @@ -281,7 +281,7 @@ grn_output_float(grn_ctx *ctx, grn_obj *outbuf, grn_content_type output_type, do GRN_TEXT_PUTS(ctx, outbuf, "</FLOAT>"); break; case GRN_CONTENT_MSGPACK : -#if HAVE_MESSAGE_PACK +#ifdef HAVE_MESSAGE_PACK msgpack_pack_double(&ctx->impl->msgpacker, value); #endif break; @@ -309,7 +309,7 @@ grn_output_str(grn_ctx *ctx, grn_obj *outbuf, grn_content_type output_type, GRN_TEXT_PUTS(ctx, outbuf, "</TEXT>"); break; case GRN_CONTENT_MSGPACK : -#if HAVE_MESSAGE_PACK +#ifdef HAVE_MESSAGE_PACK msgpack_pack_raw(&ctx->impl->msgpacker, value_len); msgpack_pack_raw_body(&ctx->impl->msgpacker, value, value_len); #endif @@ -344,7 +344,7 @@ grn_output_bool(grn_ctx *ctx, grn_obj *outbuf, grn_content_type output_type, cha GRN_TEXT_PUTS(ctx, outbuf, "</BOOL>"); break; case GRN_CONTENT_MSGPACK : -#if HAVE_MESSAGE_PACK +#ifdef HAVE_MESSAGE_PACK if (value) { msgpack_pack_true(&ctx->impl->msgpacker); } else { @@ -374,7 +374,7 @@ grn_output_void(grn_ctx *ctx, grn_obj *outbuf, grn_content_type output_type, GRN_TEXT_PUTS(ctx, outbuf, "<NULL/>"); break; case GRN_CONTENT_MSGPACK : -#if HAVE_MESSAGE_PACK +#ifdef HAVE_MESSAGE_PACK msgpack_pack_nil(&ctx->impl->msgpacker); #endif break; @@ -406,7 +406,7 @@ grn_output_time(grn_ctx *ctx, grn_obj *outbuf, grn_content_type output_type, int GRN_TEXT_PUTS(ctx, outbuf, "</DATE>"); break; case GRN_CONTENT_MSGPACK : -#if HAVE_MESSAGE_PACK +#ifdef HAVE_MESSAGE_PACK msgpack_pack_double(&ctx->impl->msgpacker, dv); #endif break; @@ -454,7 +454,7 @@ grn_output_geo_point(grn_ctx *ctx, grn_obj *outbuf, grn_content_type output_type GRN_TEXT_PUTS(ctx, outbuf, "</GEO_POINT>"); break; case GRN_CONTENT_MSGPACK : -#if HAVE_MESSAGE_PACK +#ifdef HAVE_MESSAGE_PACK // TODO %dx%d notation for compatibility msgpack_pack_array(&ctx->impl->msgpacker, 2); msgpack_pack_int(&ctx->impl->msgpacker, value->latitude); Modified: lib/ql.h (+2 -2) =================================================================== --- lib/ql.h 2011-12-14 09:29:40 +0000 (149e3f4) +++ lib/ql.h 2011-12-14 10:02:05 +0000 (c8664b2) @@ -38,7 +38,7 @@ #include <math.h> -#if HAVE_MESSAGE_PACK +#ifdef HAVE_MESSAGE_PACK #include <msgpack.h> #endif @@ -273,7 +273,7 @@ struct _grn_ctx_impl { uint64_t u64; } data; -#if HAVE_MESSAGE_PACK +#ifdef HAVE_MESSAGE_PACK msgpack_packer msgpacker; #endif };