From: Roger Dingledine Date: Sat, 20 Nov 2004 07:08:00 +0000 (+0000) Subject: simplify close_temp_logs() X-Git-Tag: tor-0.0.9rc1~44 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a30a5bce0fab1f5a16f454038666292bbd6c7740;p=thirdparty%2Ftor.git simplify close_temp_logs() (nick, did i break this?) svn:r2913 --- diff --git a/src/common/log.c b/src/common/log.c index 21d967e075..49ad0bd525 100644 --- a/src/common/log.c +++ b/src/common/log.c @@ -345,16 +345,16 @@ int add_callback_log(int loglevelMin, int loglevelMax, log_callback cb) /** Close any log handlers added by add_temp_log or marked by mark_logs_temp */ void close_temp_logs(void) { - logfile_t *lf, **p; - for (p = &logfiles; *p; ) { - if ((*p)->is_temporary) { - lf = *p; - *p = (*p)->next; - close_log(lf); - tor_free(lf->filename); - tor_free(lf); + logfile_t *victim, *lf; + for (lf = logfiles; lf; ) { + if (lf->is_temporary) { + victim = lf; + lf = lf->next; + close_log(victim); + tor_free(victim->filename); + tor_free(victim); } else { - p = &((*p)->next); + lf = lf->next; } } }