From: Stephen D. <sd...@us...> - 2005-08-02 01:45:42
|
Update of /cvsroot/naviserver/naviserver/nsd In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21478/nsd Modified Files: dsprintf.c dstring.c Log Message: Untabify, reformat and add CONST declarations. Index: dstring.c =================================================================== RCS file: /cvsroot/naviserver/naviserver/nsd/dstring.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** dstring.c 10 Jun 2005 17:58:38 -0000 1.2 --- dstring.c 2 Aug 2005 01:45:33 -0000 1.3 *************** *** 1,7 **** /* ! * The contents of this file are subject to the AOLserver Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at ! * http://aolserver.com/. * * Software distributed under the License is distributed on an "AS IS" --- 1,7 ---- /* ! * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at ! * http://mozilla.org/. * * Software distributed under the License is distributed on an "AS IS" *************** *** 32,37 **** * dstring.c -- * ! * Ns_DString routines. Ns_DString's are now compatible ! * with Tcl_DString's. */ --- 32,37 ---- * dstring.c -- * ! * Ns_DString routines. Ns_DString's are now compatible ! * with Tcl_DString's. */ *************** *** 46,56 **** * Ns_DStringVarAppend -- * ! * Append a variable number of string arguments to a dstring. * * Results: ! * Pointer to current dstring value. * * Side effects: ! * None. * *---------------------------------------------------------------------- --- 46,56 ---- * Ns_DStringVarAppend -- * ! * Append a variable number of string arguments to a dstring. * * Results: ! * Pointer to current dstring value. * * Side effects: ! * None. * *---------------------------------------------------------------------- *************** *** 65,71 **** va_start(ap, dsPtr); while ((s = va_arg(ap, char *)) != NULL) { ! Ns_DStringAppend(dsPtr, s); } va_end(ap); return dsPtr->string; } --- 65,72 ---- va_start(ap, dsPtr); while ((s = va_arg(ap, char *)) != NULL) { ! Ns_DStringAppend(dsPtr, s); } va_end(ap); + return dsPtr->string; } *************** *** 77,88 **** * Ns_DStringExport -- * ! * Return a copy of the string value on the heap. ! * Ns_DString is left in an initialized state. * * Results: ! * Pointer to ns_malloc'ed string which must be eventually freed. * * Side effects: ! * None. * * --- 78,89 ---- * Ns_DStringExport -- * ! * Return a copy of the string value on the heap. ! * Ns_DString is left in an initialized state. * * Results: ! * Pointer to ns_malloc'ed string which must be eventually freed. * * Side effects: ! * None. * * *************** *** 96,106 **** if (dsPtr->string != dsPtr->staticSpace) { ! s = dsPtr->string; ! dsPtr->string = dsPtr->staticSpace; } else { ! s = ns_malloc((size_t)dsPtr->length+1); ! memcpy(s, dsPtr->string, (size_t)(dsPtr->length+1)); } Ns_DStringFree(dsPtr); return s; } --- 97,108 ---- if (dsPtr->string != dsPtr->staticSpace) { ! s = dsPtr->string; ! dsPtr->string = dsPtr->staticSpace; } else { ! s = ns_malloc((size_t) dsPtr->length+1); ! memcpy(s, dsPtr->string, (size_t) (dsPtr->length+1)); } Ns_DStringFree(dsPtr); + return s; } *************** *** 114,118 **** * * Results: ! * Pointer to the current string value. * * Side effects: --- 116,120 ---- * * Results: ! * Pointer to the current string value. * * Side effects: *************** *** 123,129 **** char * ! Ns_DStringAppendArg(Ns_DString *dsPtr, char *string) { ! return Ns_DStringNAppend(dsPtr, string, (int)strlen(string) + 1); } --- 125,131 ---- char * ! Ns_DStringAppendArg(Ns_DString *dsPtr, CONST char *string) { ! return Ns_DStringNAppend(dsPtr, string, (int) strlen(string) + 1); } *************** *** 133,140 **** * Ns_DStringPrintf -- * ! * Append a sequence of values using a format string * * Results: ! * Pointer to the current string value. * * Side effects: --- 135,142 ---- * Ns_DStringPrintf -- * ! * Append a sequence of values using a format string. * * Results: ! * Pointer to the current string value. * * Side effects: *************** *** 145,149 **** char * ! Ns_DStringPrintf(Ns_DString *dsPtr, char *fmt,...) { char *str; --- 147,151 ---- char * ! Ns_DStringPrintf(Ns_DString *dsPtr, CONST char *fmt, ...) { char *str; *************** *** 153,156 **** --- 155,159 ---- str = Ns_DStringVPrintf(dsPtr, fmt, ap); va_end(ap); + return str; } *************** *** 162,169 **** * * Append an argv vector pointing to the null terminated ! * strings in the given dstring. * * Results: ! * Pointer char ** vector appended to end of dstring. * * Side effects: --- 165,172 ---- * * Append an argv vector pointing to the null terminated ! * strings in the given dstring. * * Results: ! * Pointer char ** vector appended to end of dstring. * * Side effects: *************** *** 177,181 **** { char *s, **argv; ! int i, argc, len, size; /* --- 180,184 ---- { char *s, **argv; ! int i, argc, len, size; /* *************** *** 186,191 **** s = dsPtr->string; while (*s != '\0') { ! ++argc; ! s += strlen(s) + 1; } --- 189,194 ---- s = dsPtr->string; while (*s != '\0') { ! ++argc; ! s += strlen(s) + 1; } *************** *** 206,213 **** argv = (char **) (s + len); for (i = 0; i < argc; ++i) { ! argv[i] = s; ! s += strlen(s) + 1; } argv[i] = NULL; return argv; } --- 209,217 ---- argv = (char **) (s + len); for (i = 0; i < argc; ++i) { ! argv[i] = s; ! s += strlen(s) + 1; } argv[i] = NULL; + return argv; } *************** *** 221,225 **** * * Results: ! * Pointer to Ns_DString. * * Side effects: --- 225,229 ---- * * Results: ! * Pointer to Ns_DString. * * Side effects: *************** *** 246,250 **** * * Results: ! * None. * * Side effects: --- 250,254 ---- * * Results: ! * None. * * Side effects: *************** *** 266,270 **** * Compatibility routines -- * ! * Wrappers for old Ns_DString functions. * * Results: --- 270,274 ---- * Compatibility routines -- * ! * Wrappers for old Ns_DString functions. * * Results: Index: dsprintf.c =================================================================== RCS file: /cvsroot/naviserver/naviserver/nsd/dsprintf.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** dsprintf.c 10 Jun 2005 17:58:38 -0000 1.2 --- dsprintf.c 2 Aug 2005 01:45:33 -0000 1.3 *************** *** 32,39 **** * dsprintf.c -- * ! * Safe Ns_DStringVPrint(dsPtr, fmt, va_list) for flexible ! * format string based appending to a dstring. This code ! * is based on the vfprintf() function from the NetBSD sources ! * (see copyright below). */ --- 32,39 ---- * dsprintf.c -- * ! * Safe Ns_DStringVPrint(dsPtr, fmt, va_list) for flexible ! * format string based appending to a dstring. This code ! * is based on the vfprintf() function from the NetBSD sources ! * (see copyright below). */ *************** *** 111,115 **** char * ! Ns_DStringVPrintf(Tcl_DString *dsPtr, char *fmt0, va_list ap) { CONST char *fmt;/* format string */ --- 111,115 ---- char * ! Ns_DStringVPrintf(Tcl_DString *dsPtr, CONST char *fmt0, va_list ap) { CONST char *fmt;/* format string */ |