Check-in Number:
|
2245 | |
Date: |
2002-Jul-05 19:15:14 (local)
2002-Jul-05 17:15:14 (UTC) |
User: | rse |
Branch: | |
Comment: |
fix indentation in export output |
Tickets: |
|
Inspections: |
|
Files: |
|
ossp-pkg/cfg/cfg_buf.c 1.2 -> 1.3
--- cfg_buf.c 2002/07/04 14:51:21 1.2
+++ cfg_buf.c 2002/07/05 17:15:14 1.3
@@ -48,7 +48,7 @@
return CFG_OK;
}
-cfg_rc_t cfg_buf_resize(cfg_buf_t *buf, int n)
+cfg_rc_t cfg_buf_resize(cfg_buf_t *buf, signed int n)
{
char *cp;
@@ -65,9 +65,9 @@
else {
/* shrink or grow buffer */
if (buf->buf_ptr == NULL) {
- if ((buf->buf_ptr = malloc(n)) == NULL)
+ if ((buf->buf_ptr = malloc(n+1)) == NULL)
return CFG_ERR_SYS;
- buf->buf_size = n;
+ buf->buf_size = n+1;
buf->buf_len = 0;
}
else {
@@ -75,9 +75,9 @@
return CFG_ERR_SYS;
buf->buf_ptr = cp;
buf->buf_size += n;
- if (buf->buf_len > buf->buf_size) {
- buf->buf_len = buf->buf_size;
- *(buf->buf_ptr + buf->buf_len - 1) = '\0';
+ if (buf->buf_len >= buf->buf_size) {
+ buf->buf_len = buf->buf_size-1;
+ *(buf->buf_ptr + buf->buf_len) = '\0';
}
}
}
@@ -104,7 +104,7 @@
return CFG_ERR_ARG;
if ((n = cfg_fmt_vsprintf(NULL, -1, fmt, ap)) == -1)
return CFG_ERR_FMT;
- if ((rc = cfg_buf_resize(buf, n+1)) != CFG_OK)
+ if ((rc = cfg_buf_resize(buf, n)) != CFG_OK)
return rc;
if ((n = cfg_fmt_vsprintf(buf->buf_ptr + buf->buf_len,
buf->buf_size - buf->buf_len,
|
|
ossp-pkg/cfg/cfg_buf.h 1.2 -> 1.3
--- cfg_buf.h 2002/07/04 14:51:21 1.2
+++ cfg_buf.h 2002/07/05 17:15:14 1.3
@@ -43,7 +43,7 @@
};
extern cfg_rc_t cfg_buf_create (cfg_buf_t **buf);
-extern cfg_rc_t cfg_buf_resize (cfg_buf_t *buf, int n);
+extern cfg_rc_t cfg_buf_resize (cfg_buf_t *buf, signed int n);
extern cfg_rc_t cfg_buf_format (cfg_buf_t *buf, const char *fmt, ...);
extern cfg_rc_t cfg_buf_vformat (cfg_buf_t *buf, const char *fmt, va_list ap);
extern cfg_rc_t cfg_buf_content (cfg_buf_t *buf, char **ptr, size_t *len, size_t *size);
|
|
ossp-pkg/cfg/cfg_syn.c 1.5 -> 1.6
--- cfg_syn.c 2002/07/05 15:32:42 1.5
+++ cfg_syn.c 2002/07/05 17:15:14 1.6
@@ -188,7 +188,7 @@
return;
}
-static void export_indent(export_t *ctx, int n)
+static void export_indent(export_t *ctx, signed int n)
{
if (n > 0) {
while (n > 0) {
@@ -242,7 +242,10 @@
if (node2 != NULL)
export_format(ctx, " ");
}
- export_format(ctx, ";\n");
+ cfg_node_goto(node, CFG_NODE_GOTO_RBROTH, &node2);
+ if (node2 != NULL)
+ export_format(ctx, ";");
+ export_format(ctx, "\n");
}
else if (type == CFG_NODE_TYPE_TOK) {
cfg_node_get(node, CFG_NODE_ATTR_TOKEN, &token);
|
|