You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "WillAyd (via GitHub)" <gi...@apache.org> on 2023/04/14 20:22:40 UTC

[GitHub] [arrow-adbc] WillAyd commented on a diff in pull request #587: refactor(c/driver/common): Variadic arguments for StringBuilderAppend

WillAyd commented on code in PR #587:
URL: https://github.com/apache/arrow-adbc/pull/587#discussion_r1167246239


##########
c/driver/common/utils.c:
##########
@@ -124,19 +124,33 @@ void StringBuilderInit(struct StringBuilder* builder, size_t initial_size) {
   builder->size = 0;
   builder->capacity = initial_size;
 }
-void StringBuilderAppend(struct StringBuilder* builder, const char* value) {
-  size_t length = strlen(value);
-  size_t new_size = builder->size + length;
-  if (new_size > builder->capacity) {
-    size_t new_capacity = builder->size + length - builder->capacity;
-    if (builder->size == 0) new_capacity++;
-
-    builder->buffer = realloc(builder->buffer, new_capacity);
-    builder->capacity = new_capacity;
+void StringBuilderAppend(struct StringBuilder* builder, const char* fmt, ...) {
+  va_list argptr;
+  char* value;
+
+  va_start(argptr, fmt);

Review Comment:
   Nice idea - let me try that



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org