diff options
author | Roger Dingledine <arma@torproject.org> | 2004-05-01 23:29:20 +0000 |
---|---|---|
committer | Roger Dingledine <arma@torproject.org> | 2004-05-01 23:29:20 +0000 |
commit | 1558fb76500a2ab43b12d2f72c8cf255f5221233 (patch) | |
tree | e36a53d86500d73d2d5701c36da0ae126b858016 /src/common/util.c | |
parent | f6fe336ad41fadc5e21517ce97e46a190d01407e (diff) | |
download | tor-1558fb76500a2ab43b12d2f72c8cf255f5221233.tar tor-1558fb76500a2ab43b12d2f72c8cf255f5221233.tar.gz |
some patches on the patches
svn:r1761
Diffstat (limited to 'src/common/util.c')
-rw-r--r-- | src/common/util.c | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/src/common/util.c b/src/common/util.c index b788f675c..f2c6cf7ad 100644 --- a/src/common/util.c +++ b/src/common/util.c @@ -281,9 +281,9 @@ void smartlist_free(smartlist_t *sl) { } /* Change the capacity of the smartlist to 'n', so that we can grow - * the list upt to'n' elements with no further reallocation or wasted + * the list up to 'n' elements with no further reallocation or wasted * space. If 'n' is less than or equal to the number of elements - * currently in the list, reduces the list's capacity as much as + * currently in the list, reduce the list's capacity as much as * possible without losing elements. */ void smartlist_set_capacity(smartlist_t *sl, int n) { @@ -320,7 +320,7 @@ void smartlist_add(smartlist_t *sl, void *element) { sl->list[sl->num_used++] = element; } -/* Append each elements from S2 to the end of S1. */ +/* Append each element from S2 to the end of S1. */ void smartlist_add_all(smartlist_t *sl, const smartlist_t *s2) { SMARTLIST_FOREACH(s2, void *, element, smartlist_add(sl, element)); @@ -440,7 +440,7 @@ int smartlist_len(const smartlist_t *sl) return sl->num_used; } /* Insert the value 'val' as the new 'idx'th element of 'sl', moving all - * items previously at 'idx' or later forward on space. + * items previously at 'idx' or later forward one space. */ void smartlist_insert(smartlist_t *sl, int idx, void *val) { @@ -785,7 +785,8 @@ void tor_gettimeofday(struct timeval *timeval) { return; } -/* Returns the number of microseconds elapsed between *start and *end. +/* Return the number of microseconds elapsed between *start and *end. + * If start is after end, return 0. */ long tv_udiff(struct timeval *start, struct timeval *end) @@ -981,9 +982,12 @@ void spawn_exit() * socketpair.) * * Currently, only (AF_UNIX, SOCK_STREAM, 0 ) sockets are supported. - * Note that on systems without socketpair, this call will sometimes - * fail if localhost is inaccessible (for example, if the networking - * stack is down). + * + * Note that on systems without socketpair, this call will fail if + * localhost is inaccessible (for example, if the networking + * stack is down). And even if it succeeds, the socket pair will not + * be able to read while localhost is down later (the socket pair may + * even close, depending on OS-specific timeouts). **/ int tor_socketpair(int family, int type, int protocol, int fd[2]) @@ -1131,8 +1135,8 @@ file_status_t file_status(const char *fname) return FN_ERROR; } -/* Check whether dirname exists and is private. If yes returns 0. If - * it does not exist, and create is set, try to creat it and return 0 +/* Check whether dirname exists and is private. If yes return 0. If + * it does not exist, and create is set, try to create it and return 0 * on success. Else return -1. */ int check_private_dir(const char *dirname, int create) { @@ -1336,7 +1340,7 @@ int is_internal_IP(uint32_t ip) { /* Hold the result of our call to 'uname'. */ static char uname_result[256]; -/* True iff uname_Result is set. */ +/* True iff uname_result is set. */ static int uname_result_is_set = 0; /* Return a pointer to a description of our platform. @@ -1465,7 +1469,7 @@ void start_daemon(char *cp) {} void finish_daemon(void) {} #endif -/* Write the current process ID, followed by NL, into 'filaname', +/* Write the current process ID, followed by NL, into 'filename', */ void write_pidfile(char *filename) { #ifndef MS_WINDOWS @@ -1536,7 +1540,7 @@ int switch_id(char *user, char *group) { /* Set *addr to the IP address (in dotted-quad notation) stored in c. * Return 1 on success, 0 if c is badly formatted. (Like inet_aton(c,addr), - * but works on Windows.) + * but works on Windows and Solaris.) */ int tor_inet_aton(const char *c, struct in_addr* addr) { |