Commit Graph

145 Commits

Author SHA1 Message Date
Nick Mathewson
42c4670e27 r18230@catbus: nickm | 2008-02-19 18:29:43 -0500
Add a few asserts to catch possible errors found by veracode.


svn:r13598
2008-02-19 23:29:45 +00:00
Nick Mathewson
dbcf29d301 r18228@catbus: nickm | 2008-02-19 18:05:53 -0500
Chris Palmer notes that almost nobody is using smartlist_set_capacity().  Chris Palmer is right.  Remove this basically pointless function.


svn:r13596
2008-02-19 23:05:56 +00:00
Nick Mathewson
749735215b r18208@catbus: nickm | 2008-02-19 17:02:30 -0500
Add some checks in torgzip.c to make sure we never overflow size_t there.  Also make sure we do not realloc(list,0) in container.c.  Backport candidate.


svn:r13587
2008-02-19 22:05:49 +00:00
Nick Mathewson
842a33ff20 Update some copyright notices: it is now 2008.
svn:r13412
2008-02-07 05:31:47 +00:00
Roger Dingledine
f76cdc1a61 misc small fixes
svn:r13403
2008-02-06 12:46:46 +00:00
Nick Mathewson
becbafc9db r17491@catbus: nickm | 2008-01-07 11:50:24 -0500
Remove some dead code.


svn:r13053
2008-01-07 16:50:33 +00:00
Roger Dingledine
1d8a8063b9 clean up copyrights, and assign 2007 copyrights to The Tor Project, Inc
svn:r12786
2007-12-12 21:09:01 +00:00
Nick Mathewson
e0b9c893bc r16573@catbus: nickm | 2007-11-08 11:57:16 -0500
Mess with the formula for the Guard flag again.  Now it requires that you be in the most familiar 7/8 of nodes, and have above median wfu for that 7/8th.  See spec for details.  Also, log thresholds better.


svn:r12440
2007-11-08 16:58:59 +00:00
Nick Mathewson
c217be996d r14677@tombo: nickm | 2007-11-03 15:16:27 -0400
Add a smartlist_bsearch_idx function that gives more useful output than regular bsearch for the value-not-found case.


svn:r12360
2007-11-03 20:12:38 +00:00
Nick Mathewson
b0a18d1bfa r15967@catbus: nickm | 2007-10-19 14:14:47 -0400
Change meaning of "freefn" argument to smartlist_uniq so that we can remove duplicates from a list without freeing them.


svn:r12053
2007-10-19 18:56:28 +00:00
Nick Mathewson
2e131e31b5 r15861@catbus: nickm | 2007-10-16 13:10:22 -0400
Fix example use of hash table iterators


svn:r11991
2007-10-16 17:21:05 +00:00
Nick Mathewson
38ac9f6005 r14682@Kushana: nickm | 2007-09-28 15:23:38 -0400
From little acorns: redo our string and digest hashing code to be faster, since this stuff may be critical-path.


svn:r11700
2007-09-28 19:23:54 +00:00
Nick Mathewson
8c13967803 r14448@Kushana: nickm | 2007-09-17 14:26:56 -0400
Unify all of the divergent median/nth-percentile code in container.[ch]


svn:r11457
2007-09-17 18:27:49 +00:00
Nick Mathewson
d5c78593d2 r13873@Kushana: nickm | 2007-07-31 10:54:05 -0700
Split over-optimized digestmap_set code into a generic part and a digestmap-specific part.


svn:r11012
2007-08-01 15:57:48 +00:00
Nick Mathewson
23a345b3c2 r14015@catbus: nickm | 2007-07-30 13:18:05 -0400
Add missing code documentation in src/common


svn:r10991
2007-07-30 17:46:12 +00:00
Nick Mathewson
5adfa09fce r13477@catbus: nickm | 2007-06-17 14:22:03 -0400
Sun CC likes to give warnings for the do { } while(0) construction for making statement-like macros.  Define STMT_BEGIN/STMT_END macros that do the right thing, and use them everywhere.


svn:r10645
2007-06-17 18:22:39 +00:00
Nick Mathewson
93f32db438 r13476@catbus: nickm | 2007-06-17 14:04:41 -0400
Build with fewer compiler warnings on Sun.  (This and previous Sun patches are thanks to the tremendously handy services of unix-center.net.)


svn:r10644
2007-06-17 18:22:35 +00:00
Nick Mathewson
bb6f53d60c r13243@catbus: nickm | 2007-06-04 15:17:15 -0400
Start of code to compute consensus network-status stuff from a bunch of votes.  Strangely, it does not yet feel like an enormous ugly hack. 


svn:r10489
2007-06-04 19:19:01 +00:00
Nick Mathewson
79707437d9 r12933@catbus: nickm | 2007-05-24 14:10:28 -0400
Optimize digestmap_set, since it sometimes shows up in profiles.  Seems to work so far, but it isnt the prettiest thing ever.


svn:r10312
2007-05-24 18:12:38 +00:00
Nick Mathewson
a187704872 r12980@Kushana: nickm | 2007-05-18 14:11:05 -0400
Add a "swap" function to smartlist, add a "shuffle" function for smartlist to crypto.c, and make appropriate hashtable functions be more const.


svn:r10208
2007-05-18 21:19:14 +00:00
Nick Mathewson
e043b86f47 r12764@catbus: nickm | 2007-05-15 17:17:39 -0400
Enable (and cope with) more GCC 4.2 warnings.


svn:r10196
2007-05-15 21:17:48 +00:00
Nick Mathewson
82e2d6001a r11954@catbus: nickm | 2007-02-26 13:01:19 -0500
Note some optimizations that are probably not worth it for 0.1.2.x based on preliminary profiling.


svn:r9659
2007-02-26 18:01:23 +00:00
Nick Mathewson
3c691b9da6 r11785@catbus: nickm | 2007-02-12 20:27:48 -0500
Node-picking fixes: Never warn when a down node is listed in a config option (bug 348); always warn when a node in a config option is unnamed.  Also, when entrynodes is configured, then build the guard list as: (parts of EntryNodes that were guards before), (the rest of EntryNodes), (the rest of the old guards).  This last point ensures that EntryNode users will get the EntryNodes they want with the minimum change to their guard list.


svn:r9574
2007-02-13 01:27:55 +00:00
Nick Mathewson
759c58151e r11775@catbus: nickm | 2007-02-12 16:39:09 -0500
Update copyright dates.


svn:r9570
2007-02-12 21:39:53 +00:00
Nick Mathewson
fefba95363 r11629@catbus: nickm | 2007-02-02 15:06:17 -0500
Removing the last DOCDOC comment hurt so much that I had to use Doxygen to identify undocumented macros and comments, and add 150 more DOCDOCs to point out where they were.  Oops.  Hey, kids!  Fixing some of these could be your first Tor patch!


svn:r9477
2007-02-02 20:06:43 +00:00
Nick Mathewson
4cd302a1eb r11722@Kushana: nickm | 2006-12-28 13:51:42 -0500
Add a helper function for case-insensitive search through a smartlist


svn:r9198
2006-12-28 21:29:03 +00:00
Nick Mathewson
c8c36dd227 r9304@dhcp-18-188-67-85: nickm | 2006-10-20 12:22:46 -0400
Change HT_INIT from a special-case to a macro-calling-a-function like the rest of ht.h.  This might prevent errors if somebody did, I dunno, "HT_INIT(tp, hashtable++)". Based on a patch from Watson Ladd.


svn:r8776
2006-10-20 16:22:53 +00:00
Roger Dingledine
06e5b2283c minor cleanups
svn:r8622
2006-10-07 00:50:39 +00:00
Nick Mathewson
87648bdcf8 r9008@Kushana: nickm | 2006-09-29 13:50:10 -0400
Doxygen comments for code in common.  Also simplify a few code paths to be more clear/speedy/correct.


svn:r8536
2006-09-29 18:13:37 +00:00
Nick Mathewson
e58b9c1151 r8819@Kushana: nickm | 2006-09-15 00:27:45 -0400
Implement a smartlist_uniq() that will with luck not end the world.


svn:r8396
2006-09-15 04:27:58 +00:00
Nick Mathewson
f170e5798f r8692@Kushana: nickm | 2006-08-31 13:38:07 -0400
Fix bug 327 (part 2): Cast char to unsigned char before passing to toupper/tolower.  (Follow the same idiom as with isupper and friends, in case we run into the same problem on SGI or whereever it was.)


svn:r8310
2006-08-31 17:39:51 +00:00
Roger Dingledine
e64825126b turn future seg faults into asserts
svn:r6970
2006-08-03 04:23:45 +00:00
Nick Mathewson
d934607069 r6979@Kushana: nickm | 2006-07-31 13:16:58 -0400
Add assert_ok functions for strmap and digestmap; use them in unit test code.


svn:r6958
2006-07-31 18:01:27 +00:00
Nick Mathewson
2fe537c57a r6958@Kushana: nickm | 2006-07-29 18:54:15 -0400
Looks like we might need a priority queue.


svn:r6953
2006-07-31 17:59:37 +00:00
Nick Mathewson
06ffee3b67 Ooh, that could have been bad. Sort digests as digests, not strings.
svn:r6679
2006-06-22 07:29:14 +00:00
Nick Mathewson
e2697a62ac When requesting or serving resources via fingerprint/digest, request and respond in-order, removing duplicates.
svn:r6673
2006-06-21 04:57:12 +00:00
Nick Mathewson
78428dccdb Add smartlist_reverse and smartlist_pop_last.
svn:r6634
2006-06-18 07:21:35 +00:00
Roger Dingledine
5f051574d5 Happy new year!
svn:r5949
2006-02-09 05:46:49 +00:00
Roger Dingledine
a45b131590 check for integer overflows in more places, when adding elements to
smartlists. this could possibly prevent a buffer overflow on malicious
huge inputs. i don't see any, but i haven't looked carefully.


svn:r5695
2006-01-02 04:40:18 +00:00
Roger Dingledine
6005e110b9 whitespace fixes
svn:r5682
2005-12-31 06:26:10 +00:00
Nick Mathewson
7e6a41af93 Make hashtables use a little less space on 64-bit architectures.
svn:r5585
2005-12-14 21:10:06 +00:00
Nick Mathewson
1af630d32c Bite the bullet and limit all our source lines to 80 characters, the way IBM intended.
svn:r5582
2005-12-14 20:40:40 +00:00
Nick Mathewson
ce3cdecb9d Make more arguments const; do not call hash tables trees.
svn:r5487
2005-12-03 02:00:51 +00:00
Nick Mathewson
9cec3a13f5 remove some functions that are not used; #if0 out some files that are not likely to be used.
svn:r5471
2005-11-30 06:27:59 +00:00
Nick Mathewson
72cb64406a HT_NEXT invalidates the last iterator; fix rmv-related segfault.
svn:r5458
2005-11-26 00:42:25 +00:00
Roger Dingledine
b6b1b4f283 Bandaid workaround to make cvs not crash tor clients.
This is not a real fix. I didn't look at the rest of the code.
Nick?


svn:r5455
2005-11-25 02:16:10 +00:00
Nick Mathewson
05482a0899 Add functions to return number of elts in associative containers
svn:r5448
2005-11-23 07:48:13 +00:00
Nick Mathewson
a39269572f Replace balanced trees with hash tables: this should make stuff significantly faster.
svn:r5441
2005-11-23 04:18:45 +00:00
Roger Dingledine
a2a4f4ae61 cleanups and a smidgen more docs
svn:r5335
2005-11-01 03:47:55 +00:00
Nick Mathewson
5828f8920e Add a "Map from digest to void*" abstraction, since we already faked it in 3 places by encoding keys in hex and sticking them in a strmap.
svn:r5278
2005-10-18 20:11:39 +00:00
Nick Mathewson
768160c872 Inline key smartlist functions; use fast versions by default.
svn:r5265
2005-10-18 04:51:07 +00:00
Nick Mathewson
ba24193ab5 Make doxygen marginally happier
svn:r5208
2005-10-06 04:33:40 +00:00
Nick Mathewson
de198d800b Never call free() on tor_malloc()d memory. This is unlikely to be our current leak, but it may help dmalloc work.
svn:r5168
2005-09-30 20:47:58 +00:00
Nick Mathewson
26e7a05725 even better function start checks; give dmalloc a chance of working.
svn:r5162
2005-09-30 01:39:24 +00:00
Nick Mathewson
92451f74a8 Reformat inconsistent function declarations.
svn:r5160
2005-09-30 01:09:52 +00:00
Nick Mathewson
5c53545d81 Add a bunch more warnings to out warning suite; resolve them; pack structs a little better.
svn:r5150
2005-09-29 22:59:17 +00:00
Nick Mathewson
312af36126 Make smartlist_add_all more efficient.
svn:r5086
2005-09-18 02:17:02 +00:00
Nick Mathewson
d9bf9e48c0 Add documentation to a few functions in container.c; reformat function definitions
svn:r5026
2005-09-13 15:30:22 +00:00
Nick Mathewson
c1a6940e73 make compile slightly happier on const-zealous compilers
svn:r5015
2005-09-12 08:29:53 +00:00
Nick Mathewson
2689cb081b We have so many special cases for smartlists of strings, why not add a sort function?
svn:r5014
2005-09-12 08:27:01 +00:00
Nick Mathewson
8d70ae01b8 Fix a memory leak in smartlist_string_remove.
svn:r5002
2005-09-12 05:20:29 +00:00
Nick Mathewson
035b1953eb Add sorting/searching to smartlist
svn:r4977
2005-09-09 23:12:54 +00:00
Roger Dingledine
780261aa2e don't crash now that LongLivedPorts can be null
svn:r4923
2005-09-08 06:47:27 +00:00
Nick Mathewson
18c11eb3bc Be consistent about preferring foo* to struct foo*
svn:r4637
2005-07-22 21:12:10 +00:00
Roger Dingledine
8c657e4157 cosmetic fixes
svn:r4601
2005-07-18 23:33:19 +00:00
Roger Dingledine
bb97d7f4ea slightly cleaner fix
svn:r4599
2005-07-18 23:16:09 +00:00
Roger Dingledine
893652da84 bugfixes: smartlist_join_strings2() was underflowing a size_t
if you gave it an empty smartlist; and it wasn't terminating in
this case even if you asked it to.

this does not appear to be exploitable in any reasonable cases.


svn:r4598
2005-07-18 23:11:46 +00:00
Roger Dingledine
fcd0fc3364 flesh out the source file descriptions for doxygen
svn:r4404
2005-06-11 05:31:17 +00:00
Nick Mathewson
0831823763 Change end-of-file NLNL convention. It turns out arma I and I agree.
svn:r4382
2005-06-09 19:03:31 +00:00
Nick Mathewson
a6f51001a5 New whitespace normalization rule: no blank line at EOF.
svn:r4378
2005-06-09 16:46:51 +00:00
Nick Mathewson
7bf443e985 I hear the smart kinds compile before committing. Then they never miss parens
svn:r3999
2005-04-03 06:00:00 +00:00
Nick Mathewson
f696fd98bf Make smartlist_string_remove consistent with smartlist_string
svn:r3998
2005-04-03 05:58:23 +00:00
Nick Mathewson
ff545c3103 Add useful smartlist_string_remove function.
svn:r3996
2005-04-03 05:52:32 +00:00
Nick Mathewson
0e81265359 update copyright notices.
svn:r3982
2005-04-01 20:15:56 +00:00
Roger Dingledine
248867caf5 bugfix: make smartlist_join_strings2 actually use the separator/terminator
svn:r3805
2005-03-22 05:37:59 +00:00
Nick Mathewson
0a2be3c9d8 Fix strmap_free to release memory actually held by the strmap.
svn:r3708
2005-02-28 02:21:40 +00:00
Roger Dingledine
b5bddd8cfd bugfix: actually use the argument to strmap_free()
svn:r3640
2005-02-20 23:12:20 +00:00
Roger Dingledine
596d65ec3b avoid case (not yet triggered) where smartlists could grow out
of control


svn:r3636
2005-02-19 03:02:33 +00:00
Roger Dingledine
c53c7a0b4c clarify what smartlist_remove promises, since we rely on it.
svn:r3473
2005-01-31 00:24:59 +00:00
Roger Dingledine
51f47d746e clean up smartlist_string_isin so callers don't have to manage bufs
themselves


svn:r3338
2005-01-12 04:53:53 +00:00
Nick Mathewson
bbc10c2ea1 Make split(..., NULL) split on horizontal space; fix bug with tabs in config file.
svn:r3155
2004-12-16 21:10:51 +00:00
Nick Mathewson
fe6eb34a10 Solaris CC freaks out if isspace and friends get anything other than an int. We learned that, so we casted. But it is also a bad idea to cast a signed char to an int and expect things to work on win32. Now we cast to unsigned char, then to int, then pass to isspace. Ug
svn:r3120
2004-12-08 00:42:50 +00:00
Roger Dingledine
bd5524bfc7 fix comment
svn:r3110
2004-12-07 15:37:35 +00:00
Roger Dingledine
32e74d3525 fix comment
svn:r3077
2004-12-04 13:58:34 +00:00
Nick Mathewson
b457cfb5eb Spell-check strings and comments
svn:r3052
2004-12-01 03:48:14 +00:00
Nick Mathewson
7fbd297532 Suggestion from weasel: Make tor --version --version dump the cvs Id of every file.
svn:r3019
2004-11-29 22:25:31 +00:00
Nick Mathewson
6f5dbefa7e Normalize space: add one between every control keyword and control clause.
svn:r3003
2004-11-28 09:05:49 +00:00
Roger Dingledine
7c9a707900 remove emacs droppings, since nick says he doesn't need them anymore
svn:r2989
2004-11-26 04:00:55 +00:00
Nick Mathewson
22dba27d8d Normalize a few more kinds of whitespace. We now dislike:
- func (args)
  - if (x){
This doesn't normalize if(x), for(x); while(x), and friends.


svn:r2943
2004-11-22 23:28:26 +00:00
Nick Mathewson
a8f9ba91db Nobody was using the return values from smartlist_(set|del|del_keeporder), so remove them.
svn:r2823
2004-11-12 21:14:06 +00:00
Nick Mathewson
238a895e69 Add a FAST_SMARTLIST define to optionally inline smartlist_get and smartlist_len, which are two major profiling offenders.
svn:r2822
2004-11-12 20:41:52 +00:00
Roger Dingledine
865f341708 parse_line_from_file is obsolete.
svn:r2693
2004-11-06 05:18:29 +00:00
Nick Mathewson
11de62aa60 Add a slightly trickier string-join interface for making NUL-terminated string messages
svn:r2659
2004-11-03 18:28:00 +00:00
Roger Dingledine
e761cc9750 my assert.h takes extra pains to be certain to _re-include_
itself if you include it twice. this is dumb, but hey.


svn:r2653
2004-11-03 07:29:03 +00:00
Nick Mathewson
ce79bab7f1 Split util into util (general utilities), container (smartlist and strmap), and compat (cross-platform compatability).
svn:r2640
2004-11-01 20:41:47 +00:00