Kouhei Sutou
null+****@clear*****
Mon Dec 2 23:29:44 JST 2013
Kouhei Sutou 2013-12-02 23:29:44 +0900 (Mon, 02 Dec 2013) New Revision: 91b3fc5cf07318ae4c97cc07df4741df7d69bba0 https://github.com/groonga/groonga-gobject/commit/91b3fc5cf07318ae4c97cc07df4741df7d69bba0 Message: Returns result as return value instead of out parameter Modified files: groonga-gobject/ggrn-context.c groonga-gobject/ggrn-context.h Modified: groonga-gobject/ggrn-context.c (+6 -9) =================================================================== --- groonga-gobject/ggrn-context.c 2013-12-02 23:14:32 +0900 (ab32247) +++ groonga-gobject/ggrn-context.c 2013-12-02 23:29:44 +0900 (cb64770) @@ -165,16 +165,15 @@ ggrn_context_create_database(GGrnContext *context, * @command: * The Groonga command to be executed. See * http://groonga.org/docs/reference/command.html about Groonga command. - * @result: (out) (allow-none): - * The return location for the executed result of @command. - * It must be freed with g_free() when no longer needed. * * Executes a Groonga command and returns the executed result. + * + * Returns: The executed result of @command. It must be freed with + * g_free() when no longer needed. */ -void +gchar * ggrn_context_execute_command(GGrnContext *context, - const gchar *command, - gchar **result) + const gchar *command) { GGrnContextPrivate *priv = GGRN_CONTEXT_GET_PRIVATE(context); gsize command_length; @@ -187,7 +186,5 @@ ggrn_context_execute_command(GGrnContext *context, grn_ctx_send(priv->ctx, command, command_length, flags); grn_ctx_recv(priv->ctx, &received_result, &received_result_length, &received_flags); - if (result) { - *result = g_strndup(received_result, received_result_length); - } + return g_strndup(received_result, received_result_length); } Modified: groonga-gobject/ggrn-context.h (+2 -3) =================================================================== --- groonga-gobject/ggrn-context.h 2013-12-02 23:14:32 +0900 (b279906) +++ groonga-gobject/ggrn-context.h 2013-12-02 23:29:44 +0900 (be88598) @@ -63,9 +63,8 @@ gboolean ggrn_context_open_database (GGrnContext *context, gboolean ggrn_context_create_database (GGrnContext *context, const gchar *path, GError **error); -void ggrn_context_execute_command (GGrnContext *context, - const gchar *command, - gchar **result); +gchar *ggrn_context_execute_command (GGrnContext *context, + const gchar *command); G_END_DECLS -------------- next part -------------- HTML����������������������������...Download