Revision: 41518
http://brlcad.svn.sourceforge.net/brlcad/?rev=41518&view=rev
Author: starseeker
Date: 2010-12-06 22:06:12 +0000 (Mon, 06 Dec 2010)
Log Message:
-----------
Rework some of the parser code to address issues observed with the db put ebm.s
command in solids.sh regression.
Modified Paths:
--------------
brlcad/branches/cmake/src/libbu/parse.c
Modified: brlcad/branches/cmake/src/libbu/parse.c
===================================================================
--- brlcad/branches/cmake/src/libbu/parse.c 2010-12-06 21:16:40 UTC (rev
41517)
+++ brlcad/branches/cmake/src/libbu/parse.c 2010-12-06 22:06:12 UTC (rev
41518)
@@ -1281,39 +1281,22 @@
(vls->vls_len?" ":""),
sdp->sp_name,
*loc);
+ vls->vls_len += (int)strlen(cp);
} else {
- register char *p;
- register int count=0;
+ struct bu_vls tmpstr;
+ bu_vls_init(&tmpstr);
- /* count the quote characters */
- p = loc;
- while ((p=strchr(p, '"')) != (char *)NULL) {
- ++p;
- ++count;
+ /* quote the quote characters */
+ while(*loc) {
+ if (*loc == '"') {
+ bu_vls_putc(&tmpstr, '\\');
+ }
+ bu_vls_putc(&tmpstr, *loc);
+ *loc++;
}
- increase = strlen(sdp->sp_name)+strlen(loc)+5+count;
- bu_vls_extend(vls, (unsigned int)increase);
-
- cp = vls->vls_str + vls->vls_offset + vls->vls_len;
- if (vls->vls_len) (void)strcat(cp, " ");
- (void)strncat(cp, sdp->sp_name, increase-1);
- (void)strncat(cp, "=\"", increase-strlen(sdp->sp_name)-1);
- cp[vls->vls_offset + vls->vls_len - 1] = '\0';
-
- /* copy the string, escaping all the internal
- * double quote (") characters
- */
- p = &cp[strlen(cp)];
- while (*loc) {
- if (*loc == '"') {
- *p++ = '\\';
- }
- *p++ = *loc++;
- }
- *p++ = '"';
- *p = '\0';
+ bu_vls_printf(vls, "%s=\"%s\"", sdp->sp_name,
bu_vls_addr(&tmpstr));
+ bu_vls_free(&tmpstr);
}
- vls->vls_len += (int)strlen(cp);
break;
case 'S': /* XXX - DEPRECATED [7.14] */
printf("DEVELOPER DEPRECATION NOTICE: Using %%S for string
printing is deprecated, use %%V instead\n");
@@ -1362,23 +1345,11 @@
{
register size_t i = sdp->sp_count;
register int *dp = (int *)loc;
- register int tmpi;
+
+ bu_vls_printf(vls, "%s%s=%d", " ", sdp->sp_name, *dp++);
- increase = 64 * i + strlen(sdp->sp_name) + 3;
- bu_vls_extend(vls, (unsigned int)increase);
-
- cp = vls->vls_str + vls->vls_offset + vls->vls_len;
- snprintf(cp, increase, "%s%s=%d",
- (vls->vls_len?" ":""),
- sdp->sp_name, *dp++);
- tmpi = (int)strlen(cp);
- vls->vls_len += tmpi;
-
while (--i > 0) {
- cp += tmpi;
- sprintf(cp, "%c%d", COMMA, *dp++);
- tmpi = (int)strlen(cp);
- vls->vls_len += tmpi;
+ bu_vls_printf(vls, "%c%d", COMMA, *dp++);
}
}
break;
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
What happens now with your Lotus Notes apps - do you make another costly
upgrade, or settle for being marooned without product support? Time to move
off Lotus Notes and onto the cloud with Force.com, apps are easier to build,
use, and manage than apps on traditional platforms. Sign up for the Lotus
Notes Migration Kit to learn more. http://p.sf.net/sfu/salesforce-d2d
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits