[Groonga-commit] groonga/groonga at dd87541 [master] egn: use grn_text_ulltoa() instead of sprintf().

Back to archive index

susumu.yata null+****@clear*****
Fri Jun 19 09:50:42 JST 2015


susumu.yata	2015-06-19 09:50:42 +0900 (Fri, 19 Jun 2015)

  New Revision: dd87541acc2ae38f5905985e9393cbc2a8d23305
  https://github.com/groonga/groonga/commit/dd87541acc2ae38f5905985e9393cbc2a8d23305

  Message:
    egn: use grn_text_ulltoa() instead of sprintf().
    
    GitHub: #350

  Modified files:
    lib/egn.cpp

  Modified: lib/egn.cpp (+2 -3)
===================================================================
--- lib/egn.cpp    2015-06-18 23:48:58 +0900 (00c84ea)
+++ lib/egn.cpp    2015-06-19 09:50:42 +0900 (9ef9209)
@@ -31,6 +31,7 @@
 #include "grn_ctx_impl.h"
 #include "grn_db.h"
 #include "grn_output.h"
+#include "grn_str.h"
 
 // TODO: Error handling.
 
@@ -2974,9 +2975,7 @@ grn_egn_select_output(grn_ctx *ctx, grn_obj *table,
   GRN_OUTPUT_ARRAY_OPEN("RESULT", 1);
   GRN_OUTPUT_ARRAY_OPEN("RESULTSET", 2 + num_records);
   GRN_OUTPUT_ARRAY_OPEN("NHITS", 1);
-  char buf[32];
-  int len = std::sprintf(buf, "%zu", num_hits);
-  GRN_TEXT_PUT(ctx, ctx->impl->outbuf, buf, len);
+  grn_text_ulltoa(ctx, ctx->impl->outbuf, num_hits);
   GRN_OUTPUT_ARRAY_CLOSE();  // NHITS.
   GRN_OUTPUT_ARRAY_OPEN("COLUMNS", expressions.size());
   for (size_t i = 0; i < expressions.size(); ++i) {
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index