b->size = MAX(minimal_increment + b->used, needed_space);
}
strcpy(b->data + b->used, toadd);
b->size = MAX(minimal_increment + b->used, needed_space);
}
strcpy(b->data + b->used, toadd);
/* DEBUG1("Deal with '%s'",b->data);
DEBUG4("Search for %.*s, found %s (default value = %s)\n",
end_var-beg_var,beg_var,
/* DEBUG1("Deal with '%s'",b->data);
DEBUG4("Search for %.*s, found %s (default value = %s)\n",
end_var-beg_var,beg_var,
int newused = b->used + tooshort;
end += tooshort; /* update the pointer of the overall loop */
// DEBUG2("Too short (by %d chars; %d chars left in area)",val_len- (end_subst-beg_subst), b->size - b->used);
if (newused > b->size) {
/* We have to realloc the data area before (because b->size is too small). We have to update our pointers, too */
int newused = b->used + tooshort;
end += tooshort; /* update the pointer of the overall loop */
// DEBUG2("Too short (by %d chars; %d chars left in area)",val_len- (end_subst-beg_subst), b->size - b->used);
if (newused > b->size) {
/* We have to realloc the data area before (because b->size is too small). We have to update our pointers, too */
- char *newdata =
- realloc(b->data, b->used + MAX(minimal_increment, tooshort));
+ char *newdata = realloc(b->data,
+ b->used + MAX(minimal_increment,
+ tooshort));
int offset = newdata - b->data;
b->data = newdata;
b->size = b->used + MAX(minimal_increment, tooshort);
int offset = newdata - b->data;
b->data = newdata;
b->size = b->used + MAX(minimal_increment, tooshort);
-XBT_TEST_UNIT("xbt_strbuff_substitute", test_strbuff_substitute,"test the function xbt_strbuff_substitute")
+XBT_TEST_UNIT("xbt_strbuff_substitute", test_strbuff_substitute, "test the function xbt_strbuff_substitute")
xbt_test_add0("Value much longer, no braces, data before and after");
mytest("toto $t tata", "t=" force_resize, "toto " force_resize " tata");
xbt_test_add0("Value much longer, braces, data before and after");
xbt_test_add0("Value much longer, no braces, data before and after");
mytest("toto $t tata", "t=" force_resize, "toto " force_resize " tata");
xbt_test_add0("Value much longer, braces, data before and after");
- mytest("toto ${t} tata", "t=" force_resize, "toto " force_resize " tata");
+ mytest("toto ${t} tata", "t=" force_resize,
+ "toto " force_resize " tata");
xbt_test_add0("Escaped $");
mytest("\\$tutu", "tutu=t", "\\$tutu");
xbt_test_add0("Escaped $");
mytest("\\$tutu", "tutu=t", "\\$tutu");