susumu.yata
null+****@clear*****
Mon Nov 9 13:11:40 JST 2015
susumu.yata 2015-11-09 13:11:40 +0900 (Mon, 09 Nov 2015) New Revision: f85fea571d5aadd7548c22d7115baa7528f16c29 https://github.com/groonga/groonga/commit/f85fea571d5aadd7548c22d7115baa7528f16c29 Message: grn_ts: move macros for logging into lib/ts/ts_log Added files: lib/ts/ts_log.h Modified files: lib/ts.c lib/ts/sources.am Modified: lib/ts.c (+1 -14) =================================================================== --- lib/ts.c 2015-11-09 12:53:02 +0900 (0dd902e) +++ lib/ts.c 2015-11-09 13:11:40 +0900 (e183e50) @@ -35,6 +35,7 @@ #include "grn_store.h" #include "grn_str.h" +#include "ts/ts_log.h" #include "ts/ts_str.h" /*------------------------------------------------------------- @@ -43,20 +44,6 @@ enum { GRN_TS_BATCH_SIZE = 1024 }; -/* GRN_TS_DEBUG() logs a message that is useful for debug. */ -#define GRN_TS_DEBUG(...) GRN_LOG(ctx, GRN_LOG_DEBUG, __VA_ARGS__) - -/* GRN_TS_WARN() logs a warning. */ -#define GRN_TS_WARN(rc, ...) WARN(rc, __VA_ARGS__) - -/* GRN_TS_ERR() reports an error. */ -#define GRN_TS_ERR(rc, ...) ERR(rc, __VA_ARGS__) -/* GRN_TS_ERR_RETURN() reports an error and returns its error code. */ -#define GRN_TS_ERR_RETURN(rc, ...) do {\ - GRN_TS_ERR(rc, __VA_ARGS__);\ - return rc;\ -} while (GRN_FALSE) - /*------------------------------------------------------------- * grn_ts_buf. */ Modified: lib/ts/sources.am (+1 -0) =================================================================== --- lib/ts/sources.am 2015-11-09 12:53:02 +0900 (704d4ac) +++ lib/ts/sources.am 2015-11-09 13:11:40 +0900 (5f9a51a) @@ -1,3 +1,4 @@ libgrnts_la_SOURCES = \ + ts_log.h \ ts_str.c \ ts_str.h Added: lib/ts/ts_log.h (+47 -0) 100644 =================================================================== --- /dev/null +++ lib/ts/ts_log.h 2015-11-09 13:11:40 +0900 (44945ff) @@ -0,0 +1,47 @@ +/* -*- c-basic-offset: 2 -*- */ +/* + Copyright(C) 2015 Brazil + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License version 2.1 as published by the Free Software Foundation. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#ifndef GRN_TS_LOG_H +#define GRN_TS_LOG_H + +#include "../grn_ts.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* GRN_TS_DEBUG() logs a message that is useful for debug. */ +#define GRN_TS_DEBUG(...) GRN_LOG(ctx, GRN_LOG_DEBUG, __VA_ARGS__) + +/* GRN_TS_WARN() logs a warning. */ +#define GRN_TS_WARN(rc, ...) WARN(rc, __VA_ARGS__) + +/* GRN_TS_ERR() reports an error. */ +#define GRN_TS_ERR(rc, ...) ERR(rc, __VA_ARGS__) + +/* GRN_TS_ERR_RETURN() reports an error and returns its error code. */ +#define GRN_TS_ERR_RETURN(rc, ...) do {\ + GRN_TS_ERR(rc, __VA_ARGS__);\ + return rc;\ +} while (GRN_FALSE) + +#ifdef __cplusplus +} +#endif + +#endif /* GRN_TS_LOG_H */ -------------- next part -------------- HTML����������������������������... 下載