rtdealloc_stringbuffer(buffer, 0);
}
+/* Takes ownership of the passed string */
static int
append_stringbuffer(STRINGBUFFER *buffer, const char *str) {
buffer->length++;
return 0;
}
- buffer->line[buffer->length - 1] = NULL;
- buffer->line[buffer->length - 1] = rtalloc(sizeof(char) * (strlen(str) + 1));
- if (buffer->line[buffer->length - 1] == NULL) {
- rterror(_("append_stringbuffer: Could not allocate memory for appending string to buffer"));
- return 0;
- }
- strcpy(buffer->line[buffer->length - 1], str);
+ buffer->line[buffer->length - 1] = str;
return 1;
}
);
append_sql_to_buffer(buffer, sql);
- rtdealloc(sql);
sql = NULL;
}
);
append_sql_to_buffer(buffer, sql);
- rtdealloc(sql);
sql = NULL;
}
}
);
append_sql_to_buffer(buffer, sql);
- rtdealloc(sql);
return 1;
}
);
append_sql_to_buffer(buffer, sql);
- rtdealloc(sql);
return 1;
}
);
append_sql_to_buffer(buffer, sql);
- rtdealloc(sql);
sql = NULL;
return 1;
static int
copy_from_end(STRINGBUFFER *buffer) {
/* end of data */
- append_sql_to_buffer(buffer, "\\.");
+ append_sql_to_buffer(buffer, strdup("\\."));
return 1;
}
rtdealloc(_column);
append_sql_to_buffer(buffer, sql);
- rtdealloc(sql);
return 1;
}
);
append_sql_to_buffer(buffer, sql);
- rtdealloc(sql);
return 1;
}
);
append_sql_to_buffer(buffer, sql);
- rtdealloc(sql);
return 1;
}
rtdealloc(_column);
append_sql_to_buffer(buffer, sql);
- rtdealloc(sql);
return 1;
}
rtdealloc(_column);
append_sql_to_buffer(buffer, sql);
- rtdealloc(sql);
return 1;
}
/* add hexwkb to tileset */
append_stringbuffer(tileset, hex);
- rtdealloc(hex);
GDALClose(hdsDst);
/* flush if tileset gets too big */
/* add hexwkb to tileset */
append_stringbuffer(tileset, hex);
- rtdealloc(hex);
-
/* flush if tileset gets too big */
if (tileset->length > 10) {
if (!insert_records(
/* add hexwkb to tileset */
append_stringbuffer(tileset, hex);
- rtdealloc(hex);
GDALClose(hdsDst);
/* flush if tileset gets too big */
assert(config->raster_column != NULL);
if (config->transaction) {
- if (!append_sql_to_buffer(buffer, "BEGIN;")) {
+ if (!append_sql_to_buffer(buffer, strdup("BEGIN;"))) {
rterror(_("process_rasters: Could not add BEGIN statement to string buffer"));
return 0;
}
}
if (config->transaction) {
- if (!append_sql_to_buffer(buffer, "END;")) {
+ if (!append_sql_to_buffer(buffer, strdup("END;"))) {
rterror(_("process_rasters: Could not add END statement to string buffer"));
return 0;
}