Opened 7 years ago

Closed 7 years ago

#7599 closed enhancement (implemented)

convert log() to tor_log()

Reported by: dhill Owned by:
Priority: Medium Milestone: Tor: 0.2.4.x-final
Component: Core Tor/Tor Version: Tor: 0.2.4.4-alpha
Severity: Keywords:
Cc: Actual Points:
Parent ID: Points:
Reviewer: Sponsor:

Description

Just a cleanup.

Stop using log(). Get rid of the #define. Tt shadows a builtin function and is part of math.h

Child Tickets

Attachments (1)

tor.diff (56.9 KB) - added by dhill 7 years ago.
log to tor_log

Download all attachments as: .zip

Change History (6)

Changed 7 years ago by dhill

Attachment: tor.diff added

log to tor_log

comment:1 Changed 7 years ago by rransom

Status: newneeds_revision

No one is going to read that diff. Provide a simple script to do the conversion instead.

comment:2 Changed 7 years ago by rransom

https://gitweb.torproject.org/nickm/tor.git/shortlog/refs/heads/rename5285 is a good example, even though it wasn't merged (see also #5285).

comment:3 in reply to:  1 Changed 7 years ago by dhill

Replying to rransom:

No one is going to read that diff. Provide a simple script to do the conversion instead.

It is a straight forward diff. A quick scroll shows the only thing changed is log() to tor_log() and deleting the #define log.

A script is going match log() where log() is a math function ( tor_mathlog do return log() ) as well as log() in comments.

You could run:

find . -name \*.c -print | xargs perl -pi -e 's, log\(, tor_log\(,'

and diff it against my attached diff. You'll have to revert it in a few places where I mentioned above though.

comment:4 Changed 7 years ago by nickm

Milestone: Tor: 0.2.4.x-final

Worth doing. IMO the right time to merge this is in mid/late Dec, when I shouldn't have so many huge patches outstanding that will create conflicts here. The approach I'll plan to take will be:

1) Using the above technique, find all log() instances that should be tor_mathlog(). change them in a commit.
2) Write a trivial script to convert log(LOG_{DEBUG,INFO,NOTICE,WARN,ERR} into log_{debug,info,notice,warn,err}(. The script should then convert remaining log( into tor_log(. Have a commit that is nothing but the output of the script.
3) Make a third commit for whitespace fixes.

Shouldn't take more than an hour. probably much less.

comment:5 Changed 7 years ago by nickm

Resolution: implemented
Status: needs_revisionclosed

Done in master. Thanks, all!

Note: See TracTickets for help on using tickets.