mirror repository of the tor core protocol in case of issues
Go to file
Nick Mathewson d4165ef8b4 Use autoconf's FLEXIBLE_ARRAY_MEMBER for unspecified-length arrays
C99 allows a syntax for structures whose last element is of
unspecified length:
   struct s {
     int elt1;
     ...
     char last_element[];
   };

Recent (last-5-years) autoconf versions provide an
AC_C_FLEXIBLE_ARRAY_MEMBER test that defines FLEXIBLE_ARRAY_MEMBER
to either no tokens (if you have c99 flexible array support) or to 1
(if you don't).  At that point you just use offsetof
[STRUCT_OFFSET() for us] to see where last_element begins, and
allocate your structures like:

   struct s {
     int elt1;
     ...
     char last_element[FLEXIBLE_ARRAY_MEMBER];
   };

   tor_malloc(STRUCT_OFFSET(struct s, last_element) +
                                   n_elements*sizeof(char));

The advantages are:

   1) It's easier to see which structures and elements are of
      unspecified length.
   2) The compiler and related checking tools can also see which
      structures and elements are of unspecified length, in case they
      wants to try weird bounds-checking tricks or something.
   3) The compiler can warn us if we do something dumb, like try
      to stack-allocate a flexible-length structure.
2011-01-06 15:59:05 -05:00
changes Merge remote branch 'origin/maint-0.2.2' 2011-01-03 17:25:30 -05:00
contrib Merge remote branch 'origin/maint-0.2.2' 2011-01-03 11:53:28 -05:00
doc Implementing getinfo options for the pid, uid, user, and descriptor limit as per proposal 173. 2011-01-03 12:04:56 -05:00
src Use autoconf's FLEXIBLE_ARRAY_MEMBER for unspecified-length arrays 2011-01-06 15:59:05 -05:00
.gitignore Merge remote branch 'origin/maint-0.2.2' 2010-11-11 13:59:18 -05:00
acinclude.m4 Fix warnings with new versions of autoconf 2010-10-11 12:36:02 +02:00
autogen.sh Use autoreconf, not autoconf&&automake&&etc in autogen.sh 2010-09-27 11:20:12 -04:00
ChangeLog remove duplicate (wrong) changelog entry 2010-12-20 09:14:11 -05:00
configure.in Use autoconf's FLEXIBLE_ARRAY_MEMBER for unspecified-length arrays 2011-01-06 15:59:05 -05:00
Doxyfile.in Remove all svn metadata minus what I missed. 2009-05-05 17:05:46 +02:00
INSTALL Correct a broken faq link in the INSTALL file 2010-12-22 00:54:29 -05:00
LICENSE Bump copyright statements to 2011 2011-01-03 11:50:39 -05:00
Makefile.am Merge remote branch 'origin/maint-0.2.2' 2011-01-03 17:25:30 -05:00
README we have two faqs for now 2010-02-22 00:41:48 -05:00
ReleaseNotes put 0.2.1.28 release notes in place too 2010-12-16 19:20:18 -05:00
tor.spec.in Update rpm spec file so that it will build without manual intervention on all rpm-based distributions 2010-09-30 21:48:29 -04:00

Tor protects your privacy on the internet by hiding the connection
between your Internet address and the services you use. We believe Tor
is reasonably secure, but please ensure you read the instructions and
configure it properly.

To build Tor from source:
        ./configure && make && make install

Home page:
        https://www.torproject.org/

Download new versions:
        https://www.torproject.org/download.html

Documentation, including links to installation and setup instructions:
        https://www.torproject.org/documentation.html

Making applications work with Tor:
        https://wiki.torproject.org/noreply/TheOnionRouter/TorifyHOWTO

Frequently Asked Questions:
        https://www.torproject.org/faq.html
        https://wiki.torproject.org/noreply/TheOnionRouter/TorFAQ