summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbjj <bjj>2008-04-24 23:28:59 (GMT)
committerbjj <bjj>2008-04-24 23:28:59 (GMT)
commit53694ea94869980613a97f10acab5ddc15185dd2 (patch)
treebc3eeae1b36fd246648adb1ff7c02032bd03e894
parent9b98f4a039df83f211e4d83556612dbf483a1747 (diff)
downloadmoo-cvs-WAIF.zip
moo-cvs-WAIF.tar.gz
moo-cvs-WAIF.tar.bz2
moo-cvs-WAIF.tar.xz
Merge HEAD onto WAIF, bringing it approximately to 1.8.3WAIF.SYNC.4WAIF
-rw-r--r--ChangeLog.txt82
-rw-r--r--Makefile.in10
-rw-r--r--db_file.c9
-rw-r--r--db_objects.c16
-rw-r--r--db_private.h5
-rw-r--r--decompile.c9
-rw-r--r--execute.c80
-rw-r--r--list.c29
-rw-r--r--my-stdio.h8
-rw-r--r--my-unistd.h8
-rw-r--r--net_bsd_tcp.c14
-rw-r--r--net_multi.c12
-rw-r--r--net_single.c11
-rw-r--r--options.h30
-rw-r--r--program.c13
-rw-r--r--server.c33
-rw-r--r--storage.c35
-rw-r--r--storage.h30
-rw-r--r--str_intern.c2
-rw-r--r--streams.c13
-rw-r--r--streams.h7
-rw-r--r--tasks.c16
-rw-r--r--utils.c13
-rw-r--r--version.c2
24 files changed, 422 insertions, 65 deletions
diff --git a/ChangeLog.txt b/ChangeLog.txt
index 8ef2a2e..4c51c98 100644
--- a/ChangeLog.txt
+++ b/ChangeLog.txt
@@ -2313,7 +2313,7 @@ Version 1.8.0p6
-- Fixed bug where toint() accepted arguments that were not
syntactically correct (e.g., "-+5", "- 3"). Report from tijmen@dse.nl.
- Version 1.8.1
+Version 1.8.1, 10 January 2000
-- New maintainers: Ben Jackson (ben@ben.com) and Jay Carlson (nop@nop.com)
-- No significant user-visible changes to server behavior.
-- Many internal memory usage bugs fixed.
@@ -2372,3 +2372,83 @@ Version 1.8.0p6
away with reusing a type like M_VM, but this may break eventually.)
-- Server hackers should read README.rX for more information on
changes to server internals.
+
+Version 1.8.2
+Because of the long time with no release after 1.8.1, some distributors began
+to distribute 1.8.1 plus patches as 1.8.2. To avoid confusion, we have opted
+to make the next official release version 1.8.3.
+
+Version 1.8.3, in progress
+-- SF bug #887464: fixed a bug in the server's startup processing, in which it
+ scans for unknown built-in functions in active verbs (Thanks luke-jr and
+ Gavin Lambert for reports and patches.)
+-- Server will report progress every few seconds (rather than every 10k objects)
+ during potentially long-running operations (loading, validating, writing)
+-- New validation algorithms for cycle-detection and hierarchy checking vastly
+ decrease startup time on large databases.
+-- SF bug #1552816: fixed an issue that could cause tracebacks in emergency mode
+ to produce "Unknown Var type" errors
+-- SF bug #1500775: fixed two use-after-free bugs that could lead very rarely to
+ calling the wrong functions during player connection (Thanks Garance Drosehn
+ for the report and initial patch.)
+**** Changes relevant to programmers / wizards:
+-- SF bug #227620: add_verb() now returns (positive integer) verb index
+-- bf_crypt() now passes salts longer than 2 characters to the underlying C
+ function. This works fine for traditional DES crypts and supports modern
+ modular crypts like FreeBSD's. See the Programmers Manual for more details.
+-- bf_queued_tasks() entries include a 10th element (size of the task in bytes)
+-- bf_open_network_connection() accepts an optional third argument that
+ associates a specific listener object with the new connection. This
+ simplifies a lot of outbound connection management.
+-- network input is suspended on new connections until after the initial
+ #0:do_login_command call returns. Thus do_login_command may now reliably
+ set binary mode without losing data.
+-- connection_option()/connection_options()/set_connection_option() now
+ recognize the following new options:
+ (*) "intrinsic-commands"
+ which determines which (if any) of the commands
+ .program
+ PREFIX
+ SUFFIX
+ OUTPUTPREFIX
+ OUTPUTSUFFIX
+ will be recognized on that connection. Option value is a list
+ of strings, but set_connection_option() also accepts any numeric
+ value, in which case all 5 intrinsic commands are enabled/disabled
+ according to the value being true/false.
+ (*) "disable-oob"
+ which, if set true, disables all out-of-band command processing
+ on subsequent input lines, i.e., the server behaves for that
+ connection as if OUT_OF_BAND_PREFIX had never been #defined.
+ Out-of-band quoting (see below) is likewise disabled.
+-- If "disable-oob" is set false (as it is by default), then it is now the case
+ that all out-of-band lines will be processed as out-of-band commands (i.e.,
+ by #0:do_out_of_band_command) if no 'flush' command intervenes; setting of
+ "hold-input" and/or making intervening read() calls will not affect this.
+ (This fixes a bug whereby read() sometimes snarfed out-of-band lines.)
+-- Setting connection_option "binary" now disables all out-of-band processing
+ on that connection.
+**** Changes significant to people compiling and running the server:
+-- several fixes for warnings, wrong use of free() vs myfree(), etc.
+-- fixes to support modern toolchains (bison, autoconf, ...)
+-- Admins can trade faster startup for increased memory consumption by
+ disabling STRING_INTERNING in options.h
+-- Added a new compile option (MEMO_STRLEN in options.h) that optimizes away
+ most strlen computations.
+-- A new OUT_OF_BAND_QUOTE_PREFIX is added; any player input lines that begin
+ with this string will be stripped of this prefix and processed normally, even
+ if the resulting line begins with OUT_OF_BAND_PREFIX. This provides a means
+ for quoting lines that would otherwise trigger do_out_of_band_command.
+-- If the server is compiled with OUTBOUND_NETWORK, this may now be explicitly
+ enabled/disabled from the server command line using +O and -O respectively.
+-- If the server is compiled with NP_TCP, there is now a command line option
+ `-a SOURCE-ADDRESS' to bind and listen on a specific interface, instead of
+ all interfaces.
+-- Fixed some flushing issues with emergency wizard mode (-e).
+ The server now behaves a bit more sensibly when stdin comes from a pipe.
+ stdout and stderr are now closed if they are not being used.
+ (Outside of emergency wizard mode, stdout is only used on an an NP_SINGLE
+ server; stderr is only used if no logfile (-l) is specifed.)
+**** Changes relevant to server hackers:
+-- New call_verb2() accepts verb name that is a MOO string (ie, str_ref-able)
+-- str_hash() replaced with a faster (and better?) string hash function
diff --git a/Makefile.in b/Makefile.in
index 03c037e..75d5f6a 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -139,7 +139,7 @@ tags:
etags -t $(SRCS)
clean:
- rm -f $(OBJS) $(OPT_NET_OBJS) core y.tab.c y.tab.h y.output makedep eddep
+ rm -f $(OBJS) $(OPT_NET_OBJS) core parser.c y.tab.c y.tab.h y.output makedep eddep
distclean: clean
rm -f config.h Makefile config.status
@@ -156,13 +156,19 @@ depend: ${ALL_CSRCS}
###############################################################################
# $Log$
+# Revision 1.8.2.3 2008/04/24 23:28:59 bjj
+# Merge HEAD onto WAIF, bringing it approximately to 1.8.3
+#
+#
# Revision 1.8.2.2 2005/09/29 06:56:18 bjj
# Merge HEAD onto WAIF, bringing it approximately to 1.8.2
#
-#
# Revision 1.8.2.1 2002/08/29 05:44:22 bjj
# Add WAIF type as distributed in version 0.95 (one small merge).
#
+# Revision 1.10 2006/12/06 23:44:24 wrog
+# Add parser.c to clean target
+#
# Revision 1.9 2004/05/22 01:25:43 wrog
# merging in WROGUE changes (W_SRCIP, W_STARTUP, W_OOB)
#
diff --git a/db_file.c b/db_file.c
index 46bd080..d58d34f 100644
--- a/db_file.c
+++ b/db_file.c
@@ -20,6 +20,7 @@
*****************************************************************************/
#include "my-stat.h"
+#include "my-unistd.h"
#include "my-stdio.h"
#include "my-stdlib.h"
@@ -617,6 +618,8 @@ dump_database(Dump_Reason reason)
goto retryDumping;
}
} else {
+ fflush(f);
+ fsync(fileno(f));
fclose(f);
oklog("%s on %s finished\n", reason_names[reason], temp_name);
if (reason != DUMP_PANIC) {
@@ -744,6 +747,9 @@ char rcsid_db_file[] = "$Id$";
/*
* $Log$
+ * Revision 1.4.2.3 2008/04/24 23:28:59 bjj
+ * Merge HEAD onto WAIF, bringing it approximately to 1.8.3
+ *
* Revision 1.4.2.2 2005/09/29 06:56:18 bjj
* Merge HEAD onto WAIF, bringing it approximately to 1.8.2
*
@@ -751,6 +757,9 @@ char rcsid_db_file[] = "$Id$";
* Revision 1.4.2.1 2002/08/29 05:44:23 bjj
* Add WAIF type as distributed in version 0.95 (one small merge).
*
+ * Revision 1.6 2007/11/12 11:17:03 wrog
+ * sync so that checkpoint is physically written before prior checkpoint is unlinked
+ *
* Revision 1.5 2004/05/22 01:25:43 wrog
* merging in WROGUE changes (W_SRCIP, W_STARTUP, W_OOB)
*
diff --git a/db_objects.c b/db_objects.c
index 29c2e62..c1bf0c4 100644
--- a/db_objects.c
+++ b/db_objects.c
@@ -290,18 +290,18 @@ db_object_bytes(Objid oid)
Verbdef *v;
count = sizeof(Object) + sizeof(Object *);
- count += strlen(o->name) + 1;
+ count += memo_strlen(o->name) + 1;
for (v = o->verbdefs; v; v = v->next) {
count += sizeof(Verbdef);
- count += strlen(v->name) + 1;
+ count += memo_strlen(v->name) + 1;
if (v->program)
count += program_bytes(v->program);
}
count += sizeof(Propdef) * o->propdefs.cur_length;
for (i = 0; i < o->propdefs.cur_length; i++)
- count += strlen(o->propdefs.l[i].name) + 1;
+ count += memo_strlen(o->propdefs.l[i].name) + 1;
len = dbpriv_count_properties(oid);
count += (sizeof(Pval) - sizeof(Var)) * len;
@@ -555,9 +555,19 @@ char rcsid_db_objects[] = "$Id$";
/*
* $Log$
+ * Revision 1.4.2.2 2008/04/24 23:28:59 bjj
+ * Merge HEAD onto WAIF, bringing it approximately to 1.8.3
+ *
* Revision 1.4.2.1 2002/08/29 05:44:23 bjj
* Add WAIF type as distributed in version 0.95 (one small merge).
*
+ * Revision 1.5 2006/09/07 00:55:02 bjj
+ * Add new MEMO_STRLEN option which uses the refcounting mechanism to
+ * store strlen with strings. This is basically free, since most string
+ * allocations are rounded up by malloc anyway. This saves lots of cycles
+ * computing strlen. (The change is originally from jitmoo, where I wanted
+ * inline range checks for string ops).
+ *
* Revision 1.4 1998/12/14 13:17:36 nop
* Merge UNSAFE_OPTS (ref fixups); fix Log tag placement to fit CVS whims
*
diff --git a/db_private.h b/db_private.h
index b40cd2b..27e240f 100644
--- a/db_private.h
+++ b/db_private.h
@@ -165,10 +165,13 @@ extern Exception dbpriv_dbio_failed;
extern void dbpriv_set_dbio_input(FILE *);
extern void dbpriv_set_dbio_output(FILE *);
-#endif DB_PRIVATE_h
+#endif /* DB_PRIVATE_h */
/*
* $Log$
+ * Revision 1.4.2.2 2008/04/24 23:28:59 bjj
+ * Merge HEAD onto WAIF, bringing it approximately to 1.8.3
+ *
* Revision 1.4.2.1 2002/08/29 05:44:23 bjj
* Add WAIF type as distributed in version 0.95 (one small merge).
*
diff --git a/decompile.c b/decompile.c
index 33c0542..48d7de0 100644
--- a/decompile.c
+++ b/decompile.c
@@ -66,6 +66,7 @@ do { \
arm_sink = &(temp->next); \
} while (0);
+#define SKIP_BYTES(n) ((void)(ptr += n))
#define READ_BYTES(n) \
(ptr += n, \
(n == 1 \
@@ -82,7 +83,7 @@ do { \
#define READ_LITERAL() program->literals[READ_BYTES(bc.numbytes_literal)]
#define READ_FORK() program->fork_vectors[READ_BYTES(bc.numbytes_fork)]
#define READ_ID() READ_BYTES(bc.numbytes_var_name)
-#define READ_STACK() READ_BYTES(bc.numbytes_stack)
+#define READ_STACK() SKIP_BYTES(bc.numbytes_stack)
#define READ_JUMP(is_hot) read_jump(bc.numbytes_label, &ptr, &is_hot)
@@ -994,9 +995,15 @@ char rcsid_decompile[] = "$Id$";
/*
* $Log$
+ * Revision 1.5.2.2 2008/04/24 23:28:59 bjj
+ * Merge HEAD onto WAIF, bringing it approximately to 1.8.3
+ *
* Revision 1.5.2.1 2005/09/29 06:56:18 bjj
* Merge HEAD onto WAIF, bringing it approximately to 1.8.2
*
+ * Revision 1.7 2006/12/06 23:51:31 wrog
+ * Fix compiler warnings about unused values
+ *
* Revision 1.6 2002/09/15 23:21:01 xplat
* GNU indent normalization.
*
diff --git a/execute.c b/execute.c
index c119cd0..42a4e7d 100644
--- a/execute.c
+++ b/execute.c
@@ -751,7 +751,7 @@ run(char raise, enum error resumption_error, Var * result)
+ ((unsigned) bv[-2] << 8) \
+ bv[-1]))))
-#define SKIP_BYTES(bv, nb) (void)(bv += nb)
+#define SKIP_BYTES(bv, nb) ((void)(bv += nb))
#define LOAD_STATE_VARIABLES() \
do { \
@@ -829,8 +829,10 @@ do { \
Var cond;
cond = POP();
- if (!is_true(cond)) /* jump if false */
- JUMP(READ_BYTES(bv, bc.numbytes_label));
+ if (!is_true(cond)) { /* jump if false */
+ unsigned lab = READ_BYTES(bv, bc.numbytes_label);
+ JUMP(lab);
+ }
else {
SKIP_BYTES(bv, bc.numbytes_label);
}
@@ -839,7 +841,10 @@ do { \
break;
case OP_JUMP:
- JUMP(READ_BYTES(bv, bc.numbytes_label));
+ {
+ unsigned lab = READ_BYTES(bv, bc.numbytes_label);
+ JUMP(lab);
+ }
break;
case OP_FOR_LIST:
@@ -1012,12 +1017,13 @@ do { \
|| (list.type == TYPE_LIST
&& index.v.num > list.v.list[0].v.num /* size */ )
|| (list.type == TYPE_STR
- && index.v.num > (int) strlen(list.v.str))) {
+ && index.v.num > (int) memo_strlen(list.v.str))) {
free_var(value);
free_var(index);
free_var(list);
PUSH_ERROR(E_RANGE);
- } else if (list.type == TYPE_STR && strlen(value.v.str) != 1) {
+ } else if (list.type == TYPE_STR
+ && memo_strlen(value.v.str) != 1) {
free_var(value);
free_var(index);
free_var(list);
@@ -1230,10 +1236,11 @@ do { \
ans = do_add(lhs, rhs);
else if (lhs.type == TYPE_STR && rhs.type == TYPE_STR) {
char *str;
+ int llen = memo_strlen(lhs.v.str);
- str = mymalloc((strlen(rhs.v.str) + strlen(lhs.v.str) + 1)
- * sizeof(char), M_STRING);
- sprintf(str, "%s%s", lhs.v.str, rhs.v.str);
+ str = mymalloc(llen + memo_strlen(rhs.v.str) + 1, M_STRING);
+ strcpy(str, lhs.v.str);
+ strcpy(str + llen, rhs.v.str);
ans.type = TYPE_STR;
ans.v.str = str;
} else {
@@ -1353,7 +1360,7 @@ do { \
}
} else { /* list.type == TYPE_STR */
if (index.v.num <= 0
- || index.v.num > (int) strlen(list.v.str)) {
+ || index.v.num > (int) memo_strlen(list.v.str)) {
free_var(index);
free_var(list);
PUSH_ERROR(E_RANGE);
@@ -1397,7 +1404,7 @@ do { \
free_var(from);
PUSH_ERROR(E_TYPE);
} else {
- int len = (base.type == TYPE_STR ? strlen(base.v.str)
+ int len = (base.type == TYPE_STR ? memo_strlen(base.v.str)
: base.v.list[0].v.num);
if (from.v.num <= to.v.num
&& (from.v.num <= 0 || from.v.num > len
@@ -1817,7 +1824,7 @@ do { \
free_var(value);
PUSH_ERROR(E_TYPE);
} else if (rangeset_check(base.type == TYPE_STR
- ? strlen(base.v.str)
+ ? memo_strlen(base.v.str)
: base.v.list[0].v.num,
from.v.num, to.v.num)) {
free_var(base);
@@ -1840,7 +1847,7 @@ do { \
v.type = TYPE_INT;
item = RUN_ACTIV.base_rt_stack[i];
if (item.type == TYPE_STR) {
- v.v.num = strlen(item.v.str);
+ v.v.num = memo_strlen(item.v.str);
PUSH(v);
} else if (item.type == TYPE_LIST) {
v.v.num = item.v.list[0].v.num;
@@ -1959,6 +1966,7 @@ do { \
{
Var v, marker;
int i;
+ unsigned lab;
if (eop == EOP_END_CATCH)
v = POP();
@@ -1974,7 +1982,8 @@ do { \
if (eop == EOP_END_CATCH)
PUSH(v);
- JUMP(READ_BYTES(bv, bc.numbytes_label));
+ lab = READ_BYTES(bv, bc.numbytes_label);
+ JUMP(lab);
}
break;
@@ -2026,7 +2035,7 @@ do { \
goto do_test;
case EOP_EXIT_ID:
- READ_BYTES(bv, bc.numbytes_var_name); /* ignore id */
+ SKIP_BYTES(bv, bc.numbytes_var_name); /* ignore id */
/* fall thru */
case EOP_EXIT:
{
@@ -2255,18 +2264,19 @@ run_interpreter(char raise, enum error e,
if (ret == OUTCOME_ABORTED && handler_verb_name) {
db_verb_handle h;
+ enum outcome hret;
Var args, handled, traceback;
int i;
args = handler_verb_args;
h = db_find_callable_verb(SYSTEM_OBJECT, handler_verb_name);
if (do_db_tracebacks && h.ptr) {
- ret = do_server_verb_task(SYSTEM_OBJECT, handler_verb_name,
- var_ref(handler_verb_args), h,
- activ_stack[0].player, "", &handled,
- 0 /*no-traceback */ );
- if ((ret == OUTCOME_DONE && is_true(handled))
- || ret == OUTCOME_BLOCKED) {
+ hret = do_server_verb_task(SYSTEM_OBJECT, handler_verb_name,
+ var_ref(handler_verb_args), h,
+ activ_stack[0].player, "", &handled,
+ 0/*no-traceback*/);
+ if ((hret == OUTCOME_DONE && is_true(handled))
+ || hret == OUTCOME_BLOCKED) {
/* Assume the in-DB code handled it */
free_var(args);
return OUTCOME_ABORTED; /* original ret value */
@@ -3028,6 +3038,10 @@ char rcsid_execute[] = "$Id$";
/*
* $Log$
+ * Revision 1.13.2.6 2008/04/24 23:28:59 bjj
+ * Merge HEAD onto WAIF, bringing it approximately to 1.8.3
+ *
+ *
* Revision 1.13.2.5 2006/04/05 00:49:29 bjj
* Critical fix for WAIF_DICT to correct a merge mistake.
*
@@ -3037,13 +3051,35 @@ char rcsid_execute[] = "$Id$";
* Revision 1.13.2.3 2005/09/29 06:56:18 bjj
* Merge HEAD onto WAIF, bringing it approximately to 1.8.2
*
- *
* Revision 1.13.2.2 2002/08/29 06:03:40 bjj
* Quiet GCC in run(), toint/tofloat(waif) raises E_TYPE and waif.wizard=0
*
* Revision 1.13.2.1 2002/08/29 05:44:23 bjj
* Add WAIF type as distributed in version 0.95 (one small merge).
*
+ * Revision 1.19 2006/12/06 23:54:53 wrog
+ * Fix compiler warnings about undefined behavior (bv assigned twice in JUMP(READ_BYTES(...))) and unused values
+ *
+ * Revision 1.18 2006/09/26 02:03:59 pschwan
+ * b=1552816
+ * r=ben
+ *
+ * execute.c:run_interpreter() sometimes clobbers the real return code with that
+ * of the traceback handler. If |result| is non-NULL, this can lead to it being
+ * used later on without ever having been initialized, causing "Unknown Var type"
+ * errors.
+ *
+ * In practice -- because |result| is almost always NULL or (in one case)
+ * initialized before calling run_interpreter() -- this situation wasn't
+ * encountered execept in Emergency Mode.
+ *
+ * Revision 1.17 2006/09/07 00:55:02 bjj
+ * Add new MEMO_STRLEN option which uses the refcounting mechanism to
+ * store strlen with strings. This is basically free, since most string
+ * allocations are rounded up by malloc anyway. This saves lots of cycles
+ * computing strlen. (The change is originally from jitmoo, where I wanted
+ * inline range checks for string ops).
+ *
* Revision 1.16 2004/05/22 01:25:43 wrog
* merging in WROGUE changes (W_SRCIP, W_STARTUP, W_OOB)
*
diff --git a/list.c b/list.c
index ee49a52..e8f0a96 100644
--- a/list.c
+++ b/list.c
@@ -350,8 +350,8 @@ strrangeset(Var base, int from, int to, Var value)
{
/* base and value are free'd */
int index, offset = 0;
- int val_len = strlen(value.v.str);
- int base_len = strlen(base.v.str);
+ int val_len = memo_strlen(value.v.str);
+ int base_len = memo_strlen(base.v.str);
int lenleft = (from > 1) ? from - 1 : 0;
int lenmiddle = val_len;
int lenright = (base_len > to) ? base_len - to : 0;
@@ -423,7 +423,7 @@ bf_length(Var arglist, Byte next, void *vdata, Objid progr)
break;
case TYPE_STR:
r.type = TYPE_INT;
- r.v.num = strlen(arglist.v.list[1].v.str);
+ r.v.num = memo_strlen(arglist.v.list[1].v.str);
break;
default:
free_var(arglist);
@@ -572,7 +572,7 @@ bf_crypt(Var arglist, Byte next, void *vdata, Objid progr)
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789./";
extern const char *crypt(const char *, const char *);
- if (arglist.v.list[0].v.num == 1 || strlen(arglist.v.list[2].v.str) < 2) {
+ if (arglist.v.list[0].v.num == 1 || memo_strlen(arglist.v.list[2].v.str) < 2) {
/* provide a random 2-letter salt, works with old and new crypts */
salt[0] = saltstuff[RANDOM() % (int) strlen(saltstuff)];
salt[1] = saltstuff[RANDOM() % (int) strlen(saltstuff)];
@@ -832,7 +832,7 @@ check_subs_list(Var subs)
|| subs.v.list[4].type != TYPE_STR)
return 1;
subj = subs.v.list[4].v.str;
- subj_length = strlen(subj);
+ subj_length = memo_strlen(subj);
if (invalid_pair(subs.v.list[1].v.num, subs.v.list[2].v.num,
subj_length))
return 1;
@@ -862,7 +862,7 @@ bf_substitute(Var arglist, Byte next, void *vdata, Objid progr)
char c = '\0';
template = arglist.v.list[1].v.str;
- template_length = strlen(template);
+ template_length = memo_strlen(template);
subs = arglist.v.list[2];
if (check_subs_list(subs)) {
@@ -870,7 +870,7 @@ bf_substitute(Var arglist, Byte next, void *vdata, Objid progr)
return make_error_pack(E_INVARG);
}
subject = subs.v.list[4].v.str;
- subject_length = strlen(subject);
+ subject_length = memo_strlen(subject);
s = new_stream(template_length);
ans.type = TYPE_STR;
@@ -971,7 +971,7 @@ bf_string_hash(Var arglist, Byte next, void *vdata, Objid progr)
const char *str = arglist.v.list[1].v.str;
r.type = TYPE_STR;
- r.v.str = hash_bytes(str, strlen(str));
+ r.v.str = hash_bytes(str, memo_strlen(str));
free_var(arglist);
return make_var_pack(r);
}
@@ -983,7 +983,7 @@ bf_value_hash(Var arglist, Byte next, void *vdata, Objid progr)
const char *lit = value_to_literal(arglist.v.list[1]);
r.type = TYPE_STR;
- r.v.str = hash_bytes(lit, strlen(lit));
+ r.v.str = hash_bytes(lit, memo_strlen(lit));
free_var(arglist);
return make_var_pack(r);
}
@@ -1150,9 +1150,20 @@ char rcsid_list[] = "$Id$";
/*
* $Log$
+ * Revision 1.6.2.2 2008/04/24 23:28:59 bjj
+ * Merge HEAD onto WAIF, bringing it approximately to 1.8.3
+ *
+ *
* Revision 1.6.2.1 2002/08/29 05:44:24 bjj
* Add WAIF type as distributed in version 0.95 (one small merge).
*
+ * Revision 1.7 2006/09/07 00:55:02 bjj
+ * Add new MEMO_STRLEN option which uses the refcounting mechanism to
+ * store strlen with strings. This is basically free, since most string
+ * allocations are rounded up by malloc anyway. This saves lots of cycles
+ * computing strlen. (The change is originally from jitmoo, where I wanted
+ * inline range checks for string ops).
+ *
* Revision 1.6 2001/03/12 00:16:29 bjj
* bf_crypt now passes the entire second argument as the salt to
* the C crypt() routine. This works fine for traditional DES crypts
diff --git a/my-stdio.h b/my-stdio.h
index 6c705bb..0fbb423 100644
--- a/my-stdio.h
+++ b/my-stdio.h
@@ -27,6 +27,7 @@
extern int fclose(FILE *);
extern int fflush(FILE *);
+extern int fileno(FILE *);
extern size_t fwrite(const void *, size_t, size_t, FILE *);
extern int fgetc(FILE *);
extern int fprintf(FILE *, const char *,...);
@@ -66,6 +67,13 @@ extern int vfscanf(FILE *, const char *, va_list);
/*
* $Log$
+ * Revision 1.3.2.1 2008/04/24 23:28:59 bjj
+ * Merge HEAD onto WAIF, bringing it approximately to 1.8.3
+ *
+ *
+ * Revision 1.4 2007/11/12 11:17:03 wrog
+ * sync so that checkpoint is physically written before prior checkpoint is unlinked
+ *
* Revision 1.3 1998/12/14 13:18:17 nop
* Merge UNSAFE_OPTS (ref fixups); fix Log tag placement to fit CVS whims
*
diff --git a/my-unistd.h b/my-unistd.h
index 5be5615..8079d4a 100644
--- a/my-unistd.h
+++ b/my-unistd.h
@@ -39,11 +39,19 @@ extern int read(int, void *, unsigned);
extern unsigned sleep(unsigned);
extern int unlink(const char *);
extern int write(int, const void *, unsigned);
+extern int fsync(int);
#endif
/*
* $Log$
+ * Revision 1.3.2.1 2008/04/24 23:28:59 bjj
+ * Merge HEAD onto WAIF, bringing it approximately to 1.8.3
+ *
+ *
+ * Revision 1.4 2007/11/12 11:17:03 wrog
+ * sync so that checkpoint is physically written before prior checkpoint is unlinked
+ *
* Revision 1.3 1998/12/14 13:18:23 nop
* Merge UNSAFE_OPTS (ref fixups); fix Log tag placement to fit CVS whims
*
diff --git a/net_bsd_tcp.c b/net_bsd_tcp.c
index aaee4dd..7b0d3e4 100644
--- a/net_bsd_tcp.c
+++ b/net_bsd_tcp.c
@@ -106,7 +106,7 @@ proto_make_listener(Var desc, int *fd, Var * canon, const char **name)
return e;
}
if (port == 0) {
- int length = sizeof(address);
+ size_t length = sizeof(address);
if (getsockname(s, (struct sockaddr *) &address, &length) < 0) {
log_perror("Discovering local port number");
@@ -139,7 +139,7 @@ proto_accept_connection(int listener_fd, int *read_fd, int *write_fd,
int timeout = server_int_option("name_lookup_timeout", 5);
int fd;
struct sockaddr_in address;
- int addr_length = sizeof(address);
+ size_t addr_length = sizeof(address);
static Stream *s = 0;
if (!s)
@@ -199,7 +199,8 @@ proto_open_connection(Var arglist, int *read_fd, int *write_fd,
static const char *host_name;
static int port;
static Timer_ID id;
- int s, result, length;
+ size_t length;
+ int s, result;
int timeout = server_int_option("name_lookup_timeout", 5);
static struct sockaddr_in addr;
static Stream *st1 = 0, *st2 = 0;
@@ -296,9 +297,16 @@ char rcsid_net_bsd_tcp[] = "$Id$";
/*
* $Log$
+ * Revision 1.3.2.2 2008/04/24 23:28:59 bjj
+ * Merge HEAD onto WAIF, bringing it approximately to 1.8.3
+ *
+ *
* Revision 1.3.2.1 2005/09/29 06:56:18 bjj
* Merge HEAD onto WAIF, bringing it approximately to 1.8.2
*
+ * Revision 1.5 2007/11/12 11:00:18 wrog
+ * fix unsigned-ness compiler warning
+ *
* Revision 1.4 2004/05/22 01:25:43 wrog
* merging in WROGUE changes (W_SRCIP, W_STARTUP, W_OOB)
*
diff --git a/net_multi.c b/net_multi.c
index 2967b2b..f396899 100644
--- a/net_multi.c
+++ b/net_multi.c
@@ -274,6 +274,10 @@ pull_input(nhandle * h)
if (isgraph(c) || c == ' ' || c == '\t')
stream_add_char(s, c);
+#ifdef INPUT_APPLY_BACKSPACE
+ else if (c == 0x08 || c == 0x7F)
+ stream_delete_char(s);
+#endif
else if (c == '\r' || (c == '\n' && !h->last_input_was_CR))
server_receive_line(h->shandle, reset_stream(s));
@@ -700,13 +704,19 @@ char rcsid_net_multi[] = "$Id$";
/*
* $Log$
+ * Revision 1.3.2.3 2008/04/24 23:28:59 bjj
+ * Merge HEAD onto WAIF, bringing it approximately to 1.8.3
+ *
+ *
* Revision 1.3.2.2 2005/10/03 05:54:36 bjj
* Re-merge HEAD into WAIF to get most recent change.
*
- *
* Revision 1.3.2.1 2005/09/29 06:56:18 bjj
* Merge HEAD onto WAIF, bringing it approximately to 1.8.2
*
+ * Revision 1.6 2006/12/06 23:57:51 wrog
+ * New INPUT_APPLY_BACKSPACE option to process backspace/delete characters on nonbinary connections (patch 1571939)
+ *
* Revision 1.5 2005/09/29 18:46:17 bjj
* Add third argument to open_network_connection() that associates a specific listener object with the new connection. This simplifies a lot of outbound connection management.
*
diff --git a/net_single.c b/net_single.c
index 9f263cd..2c4dcdc 100644
--- a/net_single.c
+++ b/net_single.c
@@ -204,6 +204,10 @@ network_process_io(int timeout)
if (isgraph(c) || c == ' ' || c == '\t')
stream_add_char(s, c);
+#ifdef INPUT_APPLY_BACKSPACE
+ else if (c == 0x08 || c == 0x7F)
+ stream_delete_char(s);
+#endif
else if (c == '\n')
server_receive_line(sh, reset_stream(s));
}
@@ -225,9 +229,16 @@ char rcsid_net_single[] = "$Id$";
/*
* $Log$
+ * Revision 1.2.4.2 2008/04/24 23:28:59 bjj
+ * Merge HEAD onto WAIF, bringing it approximately to 1.8.3
+ *
+ *
* Revision 1.2.4.1 2005/09/29 06:56:18 bjj
* Merge HEAD onto WAIF, bringing it approximately to 1.8.2
*
+ * Revision 1.4 2006/12/06 23:57:51 wrog
+ * New INPUT_APPLY_BACKSPACE option to process backspace/delete characters on nonbinary connections (patch 1571939)
+ *
* Revision 1.3 2004/05/22 01:25:44 wrog
* merging in WROGUE changes (W_SRCIP, W_STARTUP, W_OOB)
*
diff --git a/options.h b/options.h
index 2c44a15..c630c06 100644
--- a/options.h
+++ b/options.h
@@ -207,6 +207,15 @@
#define DEFAULT_CONNECT_TIMEOUT 300
/******************************************************************************
+ * On connections that have not been set to binary mode, the server normally
+ * discards incoming characters that are not printable ASCII, including
+ * backspace (8) and delete(127). If INPUT_APPLY_BACKSPACE is defined,
+ * backspace and delete cause the preceding character (if any) to be removed
+ * from the input stream. (Comment this out to restore pre-1.8.3 behavior)
+ */
+#define INPUT_APPLY_BACKSPACE
+
+/******************************************************************************
* The server maintains a cache of the most recently used patterns from calls
* to the match() and rmatch() built-in functions. PATTERN_CACHE_SIZE controls
* how many past patterns are remembered by the server. Do not set it to a
@@ -274,6 +283,13 @@
#define STRING_INTERNING /* */
/******************************************************************************
+ * Store the length of the string WITH the string rather than recomputing
+ * it each time it is needed.
+ ******************************************************************************
+ */
+/* #define MEMO_STRLEN */
+
+/******************************************************************************
* This package comes with a copy of the implementation of malloc() from GNU
* Emacs. This is a very nice and reasonably portable implementation, but some
* systems, notably the NeXT machine, won't allow programs to provide their own
@@ -391,12 +407,26 @@
/*
* $Log$
+ * Revision 1.8.2.3 2008/04/24 23:28:59 bjj
+ * Merge HEAD onto WAIF, bringing it approximately to 1.8.3
+ *
+ *
* Revision 1.8.2.2 2005/10/03 05:50:29 bjj
* Add Jay Carlson's WAIF DICT as build option.
*
* Revision 1.8.2.1 2005/09/29 07:09:50 bjj
* Merge HEAD onto WAIF, bringing it approximately to 1.8.2
*
+ * Revision 1.11 2006/12/06 23:57:51 wrog
+ * New INPUT_APPLY_BACKSPACE option to process backspace/delete characters on nonbinary connections (patch 1571939)
+ *
+ * Revision 1.10 2006/09/07 00:55:02 bjj
+ * Add new MEMO_STRLEN option which uses the refcounting mechanism to
+ * store strlen with strings. This is basically free, since most string
+ * allocations are rounded up by malloc anyway. This saves lots of cycles
+ * computing strlen. (The change is originally from jitmoo, where I wanted
+ * inline range checks for string ops).
+ *
* Revision 1.9 2004/05/22 01:25:44 wrog
* merging in WROGUE changes (W_SRCIP, W_STARTUP, W_OOB)
*
diff --git a/program.c b/program.c
index d3d752f..cffbc89 100644
--- a/program.c
+++ b/program.c
@@ -78,7 +78,7 @@ program_bytes(Program * p)
count += sizeof(const char *) * p->num_var_names;
for (i = 0; i < p->num_var_names; i++)
- count += strlen(p->var_names[i]) + 1;
+ count += memo_strlen(p->var_names[i]) + 1;
return count;
}
@@ -116,6 +116,17 @@ char rcsid_program[] = "$Id$";
/*
* $Log$
+ * Revision 1.5.2.1 2008/04/24 23:28:59 bjj
+ * Merge HEAD onto WAIF, bringing it approximately to 1.8.3
+ *
+ *
+ * Revision 1.6 2006/09/07 00:55:02 bjj
+ * Add new MEMO_STRLEN option which uses the refcounting mechanism to
+ * store strlen with strings. This is basically free, since most string
+ * allocations are rounded up by malloc anyway. This saves lots of cycles
+ * computing strlen. (The change is originally from jitmoo, where I wanted
+ * inline range checks for string ops).
+ *
* Revision 1.5 1998/12/14 13:18:48 nop
* Merge UNSAFE_OPTS (ref fixups); fix Log tag placement to fit CVS whims
*
diff --git a/server.c b/server.c
index 59ef854..e1947ad 100644
--- a/server.c
+++ b/server.c
@@ -1047,6 +1047,12 @@ player_connected(Objid old_id, Objid new_id, int is_newly_created)
new_h->connection_time = time(0);
if (existing_h) {
+ /* we now have two shandles with the same player value while
+ * find_shandle assumes there can only be one. This needs to
+ * be remedied before any call_notifier() call; luckily, the
+ * latter only needs listener value.
+ */
+ Objid existing_listener = existing_h->listener;
/* network_connection_name is allowed to reuse the same string
* storage, so we have to copy one of them.
*/
@@ -1058,7 +1064,7 @@ player_connected(Objid old_id, Objid new_id, int is_newly_created)
network_connection_name(new_h->nhandle));
free_str(name1);
if (existing_h->print_messages)
- send_message(existing_h->listener, existing_h->nhandle,
+ send_message(existing_listener, existing_h->nhandle,
"redirect_from_msg",
"*** Redirecting connection to new port ***", 0);
if (new_h->print_messages)
@@ -1066,11 +1072,13 @@ player_connected(Objid old_id, Objid new_id, int is_newly_created)
"*** Redirecting old connection to this port ***", 0);
network_close(existing_h->nhandle);
free_shandle(existing_h);
- if (existing_h->listener == new_h->listener)
+ if (existing_listener == new_h->listener)
call_notifier(new_id, new_h->listener, "user_reconnected");
else {
- call_notifier(new_id, existing_h->listener,
+ new_h->disconnect_me = 1;
+ call_notifier(new_id, existing_listener,
"user_client_disconnected");
+ new_h->disconnect_me = 0;
call_notifier(new_id, new_h->listener, "user_connected");
}
} else {
@@ -1740,7 +1748,7 @@ bf_buffered_output_length(Var arglist, Byte next, void *vdata, Objid progr)
if (nargs == 0)
r.v.num = MAX_QUEUED_OUTPUT;
else {
- shandle *h = find_shandle(arglist.v.list[1].v.obj);
+ shandle *h = find_shandle(conn);
if (!h)
return make_error_pack(E_INVARG);
@@ -1790,13 +1798,28 @@ char rcsid_server[] = "$Id$";
/*
* $Log$
+ * Revision 1.5.2.3 2008/04/24 23:28:59 bjj
+ * Merge HEAD onto WAIF, bringing it approximately to 1.8.3
+ *
+ *
* Revision 1.5.2.2 2005/10/03 05:54:36 bjj
* Re-merge HEAD into WAIF to get most recent change.
*
- *
* Revision 1.5.2.1 2005/09/29 06:56:18 bjj
* Merge HEAD onto WAIF, bringing it approximately to 1.8.2
*
+ * Revision 1.12 2007/06/02 21:34:36 wrog
+ * fix player_connect() so that the user_client_disconnected hook
+ * sees a disconnected player, same as with server_close()
+ *
+ * Revision 1.11 2007/05/29 12:21:47 wrog
+ * fixes server panic (or lost messages) caused by attempting to write to freed network handle during #0:user_reconnected; removes the one case where server and network handles were not being freed together
+ *
+ * Revision 1.10 2006/11/21 18:42:37 pschwan
+ * b=1500775
+ * fixes two use-after-free bugs that could lead very rarely to
+ * calling the wrong functions during player connection
+ *
* Revision 1.9 2005/09/29 18:46:18 bjj
* Add third argument to open_network_connection() that associates a specific listener object with the new connection. This simplifies a lot of outbound connection management.
*
diff --git a/storage.c b/storage.c
index de82378..bc33ba0 100644
--- a/storage.c
+++ b/storage.c
@@ -43,7 +43,11 @@ refcount_overhead(Memory_Type type)
/* for systems with picky double alignment */
return MAX(sizeof(int), sizeof(double));
case M_STRING:
+#ifdef MEMO_STRLEN
+ return sizeof(int) + sizeof(int);
+#else
return sizeof(int);
+#endif /* MEMO_STRLEN */
case M_LIST:
/* for systems with picky pointer alignment */
return MAX(sizeof(int), sizeof(Var *));
@@ -85,6 +89,10 @@ mymalloc(unsigned size, Memory_Type type)
if (offs) {
memptr += offs;
((int *) memptr)[-1] = 1;
+#ifdef MEMO_STRLEN
+ if (type == M_STRING)
+ ((int *) memptr)[-2] = size - 1;
+#endif /* MEMO_STRLEN */
}
return memptr;
}
@@ -111,7 +119,7 @@ str_dup(const char *s)
addref(emptystring);
return emptystring;
} else {
- r = (char *) mymalloc(strlen(s) + 1, M_STRING);
+ r = (char *) mymalloc(strlen(s) + 1, M_STRING); /* NO MEMO HERE */
strcpy(r, s);
}
return r;
@@ -132,19 +140,18 @@ myrealloc(void *ptr, unsigned size, Memory_Type type)
alloc_real_size[type] -= malloc_real_size(ptr);
#endif
- ptr = realloc((char *) ptr - offs, size + offs);
- if (!ptr) {
- sprintf(msg, "memory re-allocation (size %u) failed!", size);
- panic(msg);
- }
-
+ ptr = realloc((char *) ptr - offs, size + offs);
+ if (!ptr) {
+ sprintf(msg, "memory re-allocation (size %u) failed!", size);
+ panic(msg);
+ }
#ifdef USE_GNU_MALLOC
alloc_size[type] += malloc_size(ptr);
alloc_real_size[type] += malloc_real_size(ptr);
}
#endif
- return (char *)ptr + offs;
+ return (char *) ptr + offs;
}
void
@@ -182,6 +189,7 @@ free_str(const char *s)
if (delref(s) == 0)
myfree((void *) s, M_STRING);
}
+
#endif
Var
@@ -228,9 +236,20 @@ char rcsid_storage[] = "$Id$";
/*
* $Log$
+ * Revision 1.5.2.2 2008/04/24 23:28:59 bjj
+ * Merge HEAD onto WAIF, bringing it approximately to 1.8.3
+ *
+ *
* Revision 1.5.2.1 2002/08/29 05:44:24 bjj
* Add WAIF type as distributed in version 0.95 (one small merge).
*
+ * Revision 1.6 2006/09/07 00:55:02 bjj
+ * Add new MEMO_STRLEN option which uses the refcounting mechanism to
+ * store strlen with strings. This is basically free, since most string
+ * allocations are rounded up by malloc anyway. This saves lots of cycles
+ * computing strlen. (The change is originally from jitmoo, where I wanted
+ * inline range checks for string ops).
+ *
* Revision 1.5 1998/12/14 13:18:59 nop
* Merge UNSAFE_OPTS (ref fixups); fix Log tag placement to fit CVS whims
*
diff --git a/storage.h b/storage.h
index 5d83f53..3a0b771 100644
--- a/storage.h
+++ b/storage.h
@@ -18,7 +18,8 @@
#ifndef Storage_h
#define Storage_h 1
-#include "config.h"
+#include "my-string.h"
+
#include "structures.h"
#include "ref_count.h"
@@ -49,20 +50,45 @@ extern void myfree(void *where, Memory_Type type);
extern void *mymalloc(unsigned size, Memory_Type type);
extern void *myrealloc(void *where, unsigned size, Memory_Type type);
-static inline void /* XXX was extern, fix for non-gcc compilers */
+static inline void /* XXX was extern, fix for non-gcc compilers */
free_str(const char *s)
{
if (delref(s) == 0)
myfree((void *) s, M_STRING);
}
+#ifdef MEMO_STRLEN
+/*
+ * Using the same mechanism as ref_count.h uses to hide Value ref counts,
+ * keep a memozied strlen in the storage with the string.
+ */
+#define memo_strlen(X) ((void)0, (((int *)(X))[-2]))
+#else
+#define memo_strlen(X) strlen(X)
+
+#endif /* MEMO_STRLEN */
+
#endif /* Storage_h */
/*
* $Log$
+ * Revision 1.5.2.2 2008/04/24 23:28:59 bjj
+ * Merge HEAD onto WAIF, bringing it approximately to 1.8.3
+ *
+ *
* Revision 1.5.2.1 2002/08/29 05:44:24 bjj
* Add WAIF type as distributed in version 0.95 (one small merge).
*
+ * Revision 1.7 2006/12/06 23:44:56 wrog
+ * Fix compiler warnings about redefining strlen/strcmp
+ *
+ * Revision 1.6 2006/09/07 00:55:02 bjj
+ * Add new MEMO_STRLEN option which uses the refcounting mechanism to
+ * store strlen with strings. This is basically free, since most string
+ * allocations are rounded up by malloc anyway. This saves lots of cycles
+ * computing strlen. (The change is originally from jitmoo, where I wanted
+ * inline range checks for string ops).
+ *
* Revision 1.5 1998/12/14 13:19:00 nop
* Merge UNSAFE_OPTS (ref fixups); fix Log tag placement to fit CVS whims
*
diff --git a/str_intern.c b/str_intern.c
index 421da70..78c6413 100644
--- a/str_intern.c
+++ b/str_intern.c
@@ -243,7 +243,7 @@ str_intern(const char *s)
if (e != NULL) {
intern_allocations_saved++;
- intern_bytes_saved += strlen(s);
+ intern_bytes_saved += memo_strlen(e->s);
return str_ref(e->s);
}
diff --git a/streams.c b/streams.c
index ca318e3..2cc70fc 100644
--- a/streams.c
+++ b/streams.c
@@ -59,6 +59,13 @@ stream_add_char(Stream * s, char c)
}
void
+stream_delete_char(Stream * s)
+{
+ if (s->current > 0)
+ s->current--;
+}
+
+void
stream_add_string(Stream * s, const char *string)
{
int len = strlen(string);
@@ -231,6 +238,12 @@ char rcsid_streams[] = "$Id$";
/*
* $Log$
+ * Revision 1.3.2.1 2008/04/24 23:28:59 bjj
+ * Merge HEAD onto WAIF, bringing it approximately to 1.8.3
+ *
+ * Revision 1.4 2006/12/06 23:57:51 wrog
+ * New INPUT_APPLY_BACKSPACE option to process backspace/delete characters on nonbinary connections (patch 1571939)
+ *
* Revision 1.3 1998/12/14 13:19:01 nop
* Merge UNSAFE_OPTS (ref fixups); fix Log tag placement to fit CVS whims
*
diff --git a/streams.h b/streams.h
index c2d6a9b..913ad25 100644
--- a/streams.h
+++ b/streams.h
@@ -28,6 +28,7 @@ typedef struct {
extern Stream *new_stream(int size);
extern void stream_add_char(Stream *, char);
+extern void stream_delete_char(Stream *);
extern void stream_add_string(Stream *, const char *);
extern void stream_printf(Stream *, const char *,...);
extern void free_stream(Stream *);
@@ -39,6 +40,12 @@ extern int stream_length(Stream *);
/*
* $Log$
+ * Revision 1.3.2.1 2008/04/24 23:28:59 bjj
+ * Merge HEAD onto WAIF, bringing it approximately to 1.8.3
+ *
+ * Revision 1.4 2006/12/06 23:57:51 wrog
+ * New INPUT_APPLY_BACKSPACE option to process backspace/delete characters on nonbinary connections (patch 1571939)
+ *
* Revision 1.3 1998/12/14 13:19:02 nop
* Merge UNSAFE_OPTS (ref fixups); fix Log tag placement to fit CVS whims
*
diff --git a/tasks.c b/tasks.c
index 09b7fbe..1db0e01 100644
--- a/tasks.c
+++ b/tasks.c
@@ -1668,8 +1668,8 @@ activation_bytes(activation * ap)
}
/* XXX ignore bi_func_data, it's an opaque type. */
total += value_bytes(ap->temp) - sizeof(Var);
- total += strlen(ap->verb) + 1;
- total += strlen(ap->verbname) + 1;
+ total += memo_strlen(ap->verb) + 1;
+ total += memo_strlen(ap->verbname) + 1;
return total;
}
@@ -2239,13 +2239,23 @@ char rcsid_tasks[] = "$Id$";
/*
* $Log$
+ * Revision 1.9.2.3 2008/04/24 23:28:59 bjj
+ * Merge HEAD onto WAIF, bringing it approximately to 1.8.3
+ *
+ *
* Revision 1.9.2.2 2005/09/29 06:56:18 bjj
* Merge HEAD onto WAIF, bringing it approximately to 1.8.2
*
- *
* Revision 1.9.2.1 2002/08/29 05:44:24 bjj
* Add WAIF type as distributed in version 0.95 (one small merge).
*
+ * Revision 1.14 2006/09/07 00:55:02 bjj
+ * Add new MEMO_STRLEN option which uses the refcounting mechanism to
+ * store strlen with strings. This is basically free, since most string
+ * allocations are rounded up by malloc anyway. This saves lots of cycles
+ * computing strlen. (The change is originally from jitmoo, where I wanted
+ * inline range checks for string ops).
+ *
* Revision 1.13 2004/05/28 07:53:32 wrog
* added "intrinsic-commands" connection option
*
diff --git a/utils.c b/utils.c
index e07a169..957f699 100644
--- a/utils.c
+++ b/utils.c
@@ -377,7 +377,7 @@ value_bytes(Var v)
switch (v.type) {
case TYPE_STR:
- size += strlen(v.v.str) + 1;
+ size += memo_strlen(v.v.str) + 1;
break;
case TYPE_FLOAT:
size += sizeof(double);
@@ -459,9 +459,20 @@ char rcsid_utils[] = "$Id$";
/*
* $Log$
+ * Revision 1.7.2.2 2008/04/24 23:28:59 bjj
+ * Merge HEAD onto WAIF, bringing it approximately to 1.8.3
+ *
+ *
* Revision 1.7.2.1 2002/08/29 05:44:25 bjj
* Add WAIF type as distributed in version 0.95 (one small merge).
*
+ * Revision 1.8 2006/09/07 00:55:02 bjj
+ * Add new MEMO_STRLEN option which uses the refcounting mechanism to
+ * store strlen with strings. This is basically free, since most string
+ * allocations are rounded up by malloc anyway. This saves lots of cycles
+ * computing strlen. (The change is originally from jitmoo, where I wanted
+ * inline range checks for string ops).
+ *
* Revision 1.7 2002/08/18 09:47:26 bjj
* Finally made free_activation() take a pointer after noticing how !$%^&
* much time it was taking in a particular profiling run.
diff --git a/version.c b/version.c
index 7e78a2c..5b61b53 100644
--- a/version.c
+++ b/version.c
@@ -40,7 +40,7 @@
#include "config.h"
#include "version.h"
-const char *server_version = "1.8.2-waif";
+const char *server_version = "1.8.3-waif";
int
check_version(DB_Version version)