|
From: Andre R. <and...@us...> - 2006-02-20 21:56:34
|
Update of /cvsroot/frontierkernel/Frontier/Common/source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29116/Common/source Modified Files: langlist.c Log Message: Use handlestream in listtostring to build the string representation, in preparation for removing the 255-char limit on individual string/record items. Index: langlist.c =================================================================== RCS file: /cvsroot/frontierkernel/Frontier/Common/source/langlist.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** langlist.c 11 Jan 2005 22:48:07 -0000 1.7 --- langlist.c 20 Feb 2006 21:56:27 -0000 1.8 *************** *** 292,295 **** --- 292,298 ---- 4/2/93 dmb: next version: 255-char limit for individual items only. + + 2006-02-20 aradke: rewrite using handlestreams for efficiency. + also in preparation for revoming the 255-char limit for list items. */ *************** *** 298,307 **** tyvaluerecord itemval; bigstring bs; ! Handle hstring; boolean flisrecord = opgetisrecord (hlist); n = opcountlistitems (hlist); ! if (!newtexthandle ("\x01{", &hstring)) return (false); --- 301,312 ---- tyvaluerecord itemval; bigstring bs; ! handlestream s; boolean flisrecord = opgetisrecord (hlist); n = opcountlistitems (hlist); ! openhandlestream (nil, &s); ! ! if (!writehandlestreamchar (&s, '{')) /* creates handle, need to dispose later */ return (false); *************** *** 312,327 **** if (flisrecord) { langdeparsestring (key, chdoublequote); /*add needed escape sequences*/ ! setstringwithchar (chdoublequote, bs); ! ! pushstring (key, bs); ! ! pushchar (chdoublequote, bs); ! ! pushchar (':', bs); ! ! pushtexthandle (bs, hstring); } --- 317,334 ---- if (flisrecord) { + + if (!writehandlestreamchar (&s, chdoublequote)) + goto error; langdeparsestring (key, chdoublequote); /*add needed escape sequences*/ ! if (!writehandlestreamstring (&s, key)) ! goto error; ! ! if (!writehandlestreamchar (&s, chdoublequote)) ! goto error; ! ! if (!writehandlestreamchar (&s, ':')) ! goto error; } *************** *** 331,349 **** disposevaluerecord (itemval, true); /*don't clog temp stack*/ ! if (i < n) ! pushstring ("\x02, ", bs); ! ! if (!pushtexthandle (bs, hstring)) goto error; } ! if (!pushtexthandle ("\x01}", hstring)) goto error; ! return (setheapvalue (hstring, stringvaluetype, val)); error: ! disposehandle (hstring); return (false); --- 338,357 ---- disposevaluerecord (itemval, true); /*don't clog temp stack*/ ! if (!writehandlestreamstring (&s, bs)) goto error; + + if (i < n) + if (!writehandlestreamstring (&s, "\x02, ")) + goto error; } ! if (!writehandlestreamchar (&s, '}')) goto error; ! return (setheapvalue (closehandlestream (&s), stringvaluetype, val)); error: ! disposehandlestream (&s); return (false); |