Kouhei Sutou
null+****@clear*****
Mon Dec 2 23:10:03 JST 2013
Kouhei Sutou 2013-12-02 23:10:03 +0900 (Mon, 02 Dec 2013) New Revision: 4482714dc2e8c20814019ce4429ac5942ea79905 https://github.com/groonga/groonga-gobject/commit/4482714dc2e8c20814019ce4429ac5942ea79905 Message: Stop to pass string length as another argument It is difficult to handle by GObject Introspection. Modified files: groonga-gobject/ggrn-context.c groonga-gobject/ggrn-context.h Modified: groonga-gobject/ggrn-context.c (+6 -14) =================================================================== --- groonga-gobject/ggrn-context.c 2013-12-02 00:08:59 +0900 (65300f8) +++ groonga-gobject/ggrn-context.c 2013-12-02 23:10:03 +0900 (32155d5) @@ -135,40 +135,32 @@ ggrn_context_open_database(GGrnContext *context, /** * ggrn_context_execute_command: * @context: A #GGrnContext. - * @command: (array length=command_length) (element-type gchar): + * @command: * The Groonga command to be executed. See * http://groonga.org/docs/reference/command.html about Groonga command. - * @command_length: The length of @command, or -1 if @command is a - * NULL-terminated string. - * @result: (out) (allow-none) (array length=result_length) (element-type gint8): + * @result: (out) (allow-none): * The return location for the executed result of @command. * It must be freed with g_free() when no longer needed. - * @result_length: (out) (allow-none): - * The return location for the length of @result. * * Executes a Groonga command and returns the executed result. */ void ggrn_context_execute_command(GGrnContext *context, - const gchar *command, gssize command_length, - gchar **result, gsize *result_length) + const gchar *command, + gchar **result) { GGrnContextPrivate *priv = GGRN_CONTEXT_GET_PRIVATE(context); + gsize command_length; gint flags = 0; gchar *received_result; guint received_result_length; gint received_flags; - if (command_length == -1) { - command_length = strlen(command); - } + command_length = strlen(command); 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); } - if (result_length) { - *result_length = received_result_length; - } } Modified: groonga-gobject/ggrn-context.h (+1 -3) =================================================================== --- groonga-gobject/ggrn-context.h 2013-12-02 00:08:59 +0900 (833c24b) +++ groonga-gobject/ggrn-context.h 2013-12-02 23:10:03 +0900 (b1df75f) @@ -62,9 +62,7 @@ gboolean ggrn_context_open_database (GGrnContext *context, GError **error); void ggrn_context_execute_command (GGrnContext *context, const gchar *command, - gssize command_length, - gchar **result, - gsize *result_length); + gchar **result); G_END_DECLS -------------- next part -------------- HTML����������������������������...Download