[sword-cvs] sword/src/utilfuns swbuf.cpp,1.10,1.11
sword@www.crosswire.org
sword@www.crosswire.org
Wed, 16 Jul 2003 05:26:11 -0700
- Previous message: [sword-cvs] sword/src/modules/common rawstr.cpp,1.39,1.40 rawstr4.cpp,1.21,1.22 rawverse.cpp,1.31,1.32 zstr.cpp,1.20,1.21 zverse.cpp,1.30,1.31
- Next message: [sword-cvs] sword/debian libsword-config.conffiles,NONE,1.1 libsword-config.dirs,NONE,1.1 Makefile.am,1.1,1.2 changelog,1.3,1.4 control,1.2,1.3 libsword3c102.dirs,1.1,1.2 rules,1.2,1.3 libsword3c102.conffiles,1.1,NONE
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /usr/local/cvsroot/sword/src/utilfuns
In directory www:/tmp/cvs-serv24686/src/utilfuns
Modified Files:
swbuf.cpp
Log Message:
Some very small optimizations
Index: swbuf.cpp
===================================================================
RCS file: /usr/local/cvsroot/sword/src/utilfuns/swbuf.cpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- swbuf.cpp 27 Jun 2003 01:41:08 -0000 1.10
+++ swbuf.cpp 16 Jul 2003 12:26:09 -0000 1.11
@@ -35,8 +35,8 @@
* to a value from a const char *
*
*/
-SWBuf::SWBuf(const char *initVal) {
- init();
+SWBuf::SWBuf(const char *initVal, unsigned int initSize) {
+ init(initSize);
set(initVal);
}
@@ -45,8 +45,8 @@
* to a value from another SWBuf
*
*/
-SWBuf::SWBuf(const SWBuf &other) {
- init();
+SWBuf::SWBuf(const SWBuf &other, unsigned int initSize) {
+ init(initSize);
set(other);
}
@@ -55,20 +55,24 @@
* to a value from a char
*
*/
-SWBuf::SWBuf(char initVal) {
- init();
+SWBuf::SWBuf(char initVal, unsigned int initSize) {
+ init(initSize);
allocSize = 15;
buf = (char *)calloc(allocSize, 1);
*buf = initVal;
end = buf+1;
+ endAlloc = buf + allocSize-1;
}
-void SWBuf::init() {
+void SWBuf::init(unsigned int initSize) {
fillByte = ' ';
allocSize = 0;
+ endAlloc = 0;
buf = 0;
end = 0;
+ if (initSize)
+ assureSize(initSize);
}
/******************************************************************************
@@ -115,7 +119,7 @@
unsigned int len = strlen(str) + 1;
if ((max > -1) && (len > max + 1))
len = max + 1;
- assureSize((end-buf)+len);
+ assureMore(len);
memcpy(end, str, len-1);
end += (len-1);
*end = 0;
@@ -143,7 +147,7 @@
va_start(argptr, format);
int len = vsprintf(junkBuf, format, argptr)+1;
- assureSize((end-buf)+len);
+ assureMore(len);
end += vsprintf(end, format, argptr);
va_end(argptr);
}
- Previous message: [sword-cvs] sword/src/modules/common rawstr.cpp,1.39,1.40 rawstr4.cpp,1.21,1.22 rawverse.cpp,1.31,1.32 zstr.cpp,1.20,1.21 zverse.cpp,1.30,1.31
- Next message: [sword-cvs] sword/debian libsword-config.conffiles,NONE,1.1 libsword-config.dirs,NONE,1.1 Makefile.am,1.1,1.2 changelog,1.3,1.4 control,1.2,1.3 libsword3c102.dirs,1.1,1.2 rules,1.2,1.3 libsword3c102.conffiles,1.1,NONE
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]