Re: [Libevent-users] [PATCH] Fix handling of EVENT_BASE_FLAG_IGNORE_ENV flag.
On Tue, 2009-04-28 at 15:09 -0400, Nick Mathewson wrote: > On Sat, Apr 25, 2009 at 12:08:02PM -0700, hop...@omnifarious.org wrote: > > # HG changeset patch > > # User Eric Hopper > > # Date 1240605517 25200 > > # Node ID 97768cd771be8ea7a4db8bd46998030dcd8c6650 > > # Parent 07c00814a3436ebd1d8628fa8c3c1d921523d1e5 > > Properly detect sense of should_check_environment and fix regression. > > > Checked in, along with unit test to catch this if it happens again. > > (When possible, if you're writing a bugfix, a unit test to make sure > it doesn't recur would be great. For new features, a unit test is > highly recommended.) I didn't think to do that because the reason I fixed the bug is that the regression test suite was failing. :-) It wasn't failing for reasons that clearly pointed to the problem though, so a new test would definitely have been in order. Thanks, -- A word is nothing more or less than the series of historical connotations given to it. That's HOW we derive meaning, and to claim that there is an arbitrary meaning of words above and beyond the way people use them is a blatant misunderstanding of the nature of language. -- Anonymous blogger -- Eric Hopper (hop...@omnifarious.org http://www.omnifarious.org/~hopper)-- signature.asc Description: This is a digitally signed message part ___ Libevent-users mailing list Libevent-users@monkey.org http://monkeymail.org/mailman/listinfo/libevent-users
[Libevent-users] [PATCH] Add new EVENT_DISABLED environment variable to use instead of multiple EVENT_NO flags.
# HG changeset patch # User Eric Hopper # Date 1240605604 25200 # Node ID 8ca16c106804698455d97b9d40ba78ed97753907 # Parent 97768cd771be8ea7a4db8bd46998030dcd8c6650 Add check of single EVENT_DISABLED environment variable to avoid multiplying environmnet variables. diff -r 97768cd771be8ea7a4db8bd46998030dcd8c6650 -r 8ca16c106804698455d97b9d40ba78ed97753907 event.c --- a/event.c Fri Apr 24 13:38:37 2009 -0700 +++ b/event.c Fri Apr 24 13:40:04 2009 -0700 @@ -225,7 +225,27 @@ evutil_snprintf(environment, sizeof(environment), "EVENT_NO%s", name); for (i = 8; environment[i] != '\0'; ++i) environment[i] = toupper(environment[i]); - return (getenv(environment) != NULL); + if (getenv(environment) != NULL) { +return 1; +} else { +const char * const disabledenv = getenv("EVENT_DISABLE"); +if (disabledenv != NULL) { +const int namelen = strlen(name); +const char *ptr = strstr(disabledenv, name); +while (ptr != NULL) { +if (((ptr == disabledenv) || (*(ptr - 1) == ',')) && +((*(ptr + namelen) == '\0') || (*(ptr + namelen) == ','))) +{ +return 1; +} else if (*ptr == '\0') { +return 0; +} else { +ptr = strstr(ptr + 1, name); +} +} +} +return 0; +} } enum event_method_feature pgpDxUgjyTrev.pgp Description: PGP signature ___ Libevent-users mailing list Libevent-users@monkey.org http://monkeymail.org/mailman/listinfo/libevent-users
[Libevent-users] [PATCH] Fix handling of EVENT_BASE_FLAG_IGNORE_ENV flag.
# HG changeset patch # User Eric Hopper # Date 1240605517 25200 # Node ID 97768cd771be8ea7a4db8bd46998030dcd8c6650 # Parent 07c00814a3436ebd1d8628fa8c3c1d921523d1e5 Properly detect sense of should_check_environment and fix regression. diff -r 07c00814a3436ebd1d8628fa8c3c1d921523d1e5 -r 97768cd771be8ea7a4db8bd46998030dcd8c6650 event.c --- a/event.c Fri Apr 24 05:33:24 2009 -0700 +++ b/event.c Fri Apr 24 13:38:37 2009 -0700 @@ -262,7 +262,7 @@ base->evbase = NULL; should_check_environment = - cfg && (cfg->flags & EVENT_BASE_FLAG_IGNORE_ENV); + !(cfg && (cfg->flags & EVENT_BASE_FLAG_IGNORE_ENV)); for (i = 0; eventops[i] && !base->evbase; i++) { if (cfg != NULL) { pgpRC4WD4WL6b.pgp Description: PGP signature ___ Libevent-users mailing list Libevent-users@monkey.org http://monkeymail.org/mailman/listinfo/libevent-users