summaryrefslogtreecommitdiff
path: root/src/common/util.c
AgeCommit message (Collapse)Author
2010-09-06Merge remote branch 'public/win_unicode_fixes'Nick Mathewson
2010-08-31Fix some issues in rate-limiting noticed by SebastianNick Mathewson
2010-08-20Make the windows build succeed with or without -DUNICODE enabled.Nick Mathewson
This should keep WinCE working (unicode always-on) and get Win98 working again (unicode never-on). There are two places where we explicitly use ASCII-only APIs, still: in ntmain.c and in the unit tests. This patch also fixes a bug in windoes tor_listdir that would cause the first file to be listed an arbitrary number of times that was also introduced with WinCE support. Should fix bug 1797.
2010-08-18Add a generic rate-limited log mechanism, and use it in a few placesNick Mathewson
Incidentally fixes bug 1042.
2010-07-09Rename log.h to torlog.hNick Mathewson
This should make us conflict less with system files named "log.h". Yes, we shouldn't have been conflicting with those anyway, but some people's compilers act very oddly. The actual change was done with one "git mv", by editing Makefile.am, and running find . -name '*.[ch]' | xargs perl -i -pe 'if (/^#include.*\Wlog.h/) {s/log.h/torlog.h/; }'
2010-06-14Save a couple characters' allocation in esc_for_logFlorian Zumbiehl
2010-06-07Reinstate warning when HOME isn't set.Nick Mathewson
Having ~/.tor expand into /.tor is, after all, almost certainly not what the user wanted, and it deserves a warning message. Also, convert a guess-and-malloc-and-sprintf triple into an asprintf.
2010-06-07Treat unset $HOME like empty $HOMESebastian Hahn
This means Tor no longer dies when it doesn't have a $HOME.
2010-05-24Port Tor to work on Windows CEvalerino
Most of the changes here are switches to use APIs available on Windows CE. The most pervasive change is that Windows CE only provides the wide-character ("FooW") variants of most of the windows function, and doesn't support the older ASCII verions at all. This patch will require use of the wcecompat library to get working versions of the posix-style fd-based file IO functions. [commit message by nickm]
2010-02-27Merge remote branch 'origin/maint-0.2.1'Nick Mathewson
Conflicts: src/common/test.h src/or/test.c
2010-02-27Update Tor Project copyright yearsNick Mathewson
2010-02-22Make expand_filename into a tor_strdup() alias on windows.Nick Mathewson
On Windows, we don't have a notion of ~ meaning "our homedir", so we were deliberately using an #ifdef to avoid calling expand_filename() in multiple places. This is silly: The right place to turn a function into a no-op on a single platform is in the function itself, not in every single call-site.
2009-12-18Remove duplicate words and a duplicate newline.Karsten Loesing
2009-12-17Refactor out the 'find string at start of any line' logic.Nick Mathewson
We do this in too many places throughout the code; it's time to start clamping down. Also, refactor Karsten's patch to use strchr-then-strndup, rather than malloc-then-strlcpy-then-strchr-then-clear.
2009-12-15Refactor a bit so that it is safe to include math.h, and mostly not needed.Nick Mathewson
2009-12-12Merge commit 'sebastian/fixes'Nick Mathewson
2009-12-12Now that FOO_free(NULL) always works, remove checks before calling it.Nick Mathewson
2009-12-12Fix typo in a commentSebastian Hahn
2009-10-19Merge branch 'microdesc'Nick Mathewson
2009-10-19Document some formerly undocumented functions.Nick Mathewson
2009-10-15Make start_writing_to_stdio_file() respect O_BINARY.Nick Mathewson
2009-10-15Code to generate, store, and parse microdescriptors and consensuses.Nick Mathewson
The consensus documents are not signed properly, not served, and not exchanged yet.
2009-09-20Fix compile on Snow LeopardSebastian Hahn
2009-09-20Add a couple of time helper functions.Mike Perry
Also add rounding support to tv_mdiff().
2009-09-01Fix compile warnings on Snow LeopardSebastian Hahn
Big thanks to nickm and arma for helping me with this!
2009-09-01Merge commit 'origin/maint-0.2.1'Nick Mathewson
2009-09-01typoSebastian Hahn
2009-09-01Fix compile warnings on Snow LeopardSebastian Hahn
Big thanks to nickm and arma for helping me with this!
2009-08-31Revise parsing of time and memory units to handle spaces.Nick Mathewson
When we added support for fractional units (like 1.5 MB) I broke support for giving units with no space (like 2MB). This patch should fix that. It also adds a propoer tor_parse_double(). Fix for bug 1076. Bugfix on 0.2.2.1-alpha.
2009-07-27Fix dirreq and cell stats on 32-bit architectures.Karsten Loesing
When determining how long directory requests take or how long cells spend in queues, we were comparing timestamps on microsecond detail only to convert results to second or millisecond detail later on. But on 32-bit architectures this means that 2^31 microseconds only cover time differences of up to 36 minutes. Instead, compare timestamps on millisecond detail.
2009-07-13Two tweaks to exit-port statistics.Karsten Loesing
Add two functions for round_to_next_multiple_of() for uint32_t and uint64_t. Avoid division in every step of the loop over all ports.
2009-05-30Don't attempt to log messages to a controller from a worker thread.Nick Mathewson
This patch adds a function to determine whether we're in the main thread, and changes control_event_logmsg() to return immediately if we're in a subthread. This is necessary because otherwise we will call connection_write_to_buf, which modifies non-locked data structures. Bugfix on 0.2.0.x; fix for at least one of the things currently called "bug 977".
2009-05-27Spelling fixes in comments and stringsNick Mathewson
2009-05-17Stop using malloc_usable_size(): valgrind hates it.Nick Mathewson
2009-05-04Update copyright to 2009.Karsten Loesing
2009-03-03Actually use tor_sscanf() to parse untrusted input.Nick Mathewson
svn:r18761
2009-03-03Add a simple locale-independent no-surprises sscanf replacement.Nick Mathewson
tor_sscanf() only handles %u and %s for now, which will make it adequate to replace sscanf() for date/time/IP parsing. We want this to prevent attackers from constructing weirdly formed descriptors, cells, addresses, HTTP responses, etc, that validate under some locales but not others. svn:r18760
2009-01-22Support 64-bit time_t. Patch from Matthias Drochner. Partial backport ↵Nick Mathewson
candidate. svn:r18234
2009-01-20Add a better (non-locale-having) ctypes implementation to avoid protocol and ↵Nick Mathewson
parsing mismatches on different platforms. svn:r18189
2009-01-04OpenBSD malloc.h believes that you should be able to detect headers with ↵Nick Mathewson
autoconf, or build without warnings, but not both. So never include malloc.h on OpenBSD. Backport candidate. svn:r17891
2009-01-04Remove svn $Id$s from our source, and remove tor --version --version.Nick Mathewson
The subversion $Id$ fields made every commit force a rebuild of whatever file got committed. They were not actually useful for telling the version of Tor files in the wild. svn:r17867
2008-12-23Document most undocumented variables.Nick Mathewson
svn:r17754
2008-12-22Make freelist_len in memarea.c static; document a few variables.Nick Mathewson
svn:r17741
2008-12-22Add DOCDOC entries for undocumented static and global variables.Nick Mathewson
svn:r17739
2008-12-22Fix most DOCDOCs remaining and/or added by redox.Nick Mathewson
svn:r17734
2008-12-22Add DOCDOC comments for all undocumented functions. Add missing *s to other ↵Nick Mathewson
comments so that they will get recognized as doxygen. svn:r17729
2008-12-22Fix all of the doxygen warnings not pertaining to missing documentation.Nick Mathewson
svn:r17727
2008-12-19Expose hex_decode_digit from util.cNick Mathewson
svn:r17706
2008-12-18Replace calls to time(NULL) that occur on the order of once per read, one ↵Nick Mathewson
per write, or once per cell with calls to a function that looks at a cached value of time. This is tricksy to benchmark, since it will only help on systems where time() is a syscall and syscalls are relatively slow. svn:r17690
2008-12-18Downlgrade tweak, and answer lots of XXX021s. No actual code fixes in this ↵Nick Mathewson
patch. svn:r17686