Age | Commit message (Collapse) | Author |
|
We no longer allow `int a, b;`. In the few cases where we used it, we
instead better
* limit the scope of the identifier (e.g. in a for-init-decl)
* split the line and have 2 separate declarators, because the
identifiers designate different types of things (e.g. friend numbers
and group numbers).
|
|
|
|
See https://github.com/TokTok/hs-tokstyle/pull/49 for the corresponding
tokstyle analysis.
|
|
Remove useless parameter, replace with assert (just to be sure). Also
replaced some memsets with 0-initialiser and memcpy with assignment.
|
|
Avoid any dynamic format strings, even ones like `cond ? "str1" : "str2"`.
|
|
In windows network code, we implement inet_pton and inet_ntop, which take
void pointers. We can do slightly better because we already know the type
when we call these functions, so we can avoid casting between void
pointer and the addr struct types.
|
|
Tokstyle (check-cimple) will start enforcing comment formats at some
point. It will not support arbitrary stuff in comments, and will parse
them. The result can then be semantically analysed.
|
|
|
|
The current code violates the C standard and causes crashes on strict
alignment architectures.
|
|
Also, use them in the `onion_client` module.
|
|
This code is undefined behaviour as is, and breaks on various platforms
requiring strict alignment (many microcontrollers).
|
|
|
|
|
|
Reduced by, e.g.:
* `file_transfer_test`: 33% of the `clock_gettime` calls.
* `tox_many_test`: 53% of the `clock_gettime` calls.
Other tests will see similar improvements. Real world applications will
be closer to 40-50% improvement, since tox_many_test has 100 nodes, while
file_transfer_test has 2 nodes.
|
|
Presumably the uses of `rand()` were fine because they were not used in
security-sensitive places, but having to think about whether a crappy RNG
is acceptable in each situation requires effort that could better be
spent elsewhere.
Also, this means that once we have a custom deterministic RNG for
testing, that RNG is used everywhere, so all the code is deterministic.
It also allowed us to delete a system-specific function that wasn't used
anywhere except in a call to `srand()`.
|
|
Also, added some #defines to make symbols visible that are in BSD but not
in UNIX. Solaris needs these, since it's fairly strict with its symbol
visibility in system headers.
|
|
|
|
* Moved PAIR to toxav, where it's used (but really this should die).
* Replace most MIN calls with typed `min_*` calls. Didn't replace the
ones where the desired semantics are unclear. Moved the MIN macro to
the one place where it's still used.
* Avoid assignments in `while` loops. Instead, factored out the loop body
into a separate `bool`-returning function.
* Use named types for callbacks (`_cb` types).
* Avoid assignments in `if` conditions.
* Removed `MAKE_REALLOC` and expanded its two calls. We can't have
templates in C, and this fake templating is ugly and hard to analyse
and debug (it expands on a single line).
* Moved epoll system include to the .c file, out of the .h file.
* Avoid assignments in expressions (`a = b = c;`).
* Avoid multiple declarators per struct member declaration.
* Fix naming inconsistencies.
* Replace `net_to_host` macro with function.
|
|
It turns out, `unix_time` is also monotonic, and is used as such, so I've
renamed the new functions to `mono_time_*`.
2018-07-08:
```
00:01 <@irungentoo> the idea used to be that the unix_time() function
could go backward in time but I think I might have started using it like
if it could not after I changed it so that it would never go back in time
```
|
|
This one has ASAN enabled, unlike Travis.
|
|
In preparation for adding log statements.
Also, fix an uninitialised variable warning in cppcheck.
|
|
|
|
|
|
The Family stuff in toxcore is a big mess. I'm sure I saw a bunch of bugs
on the way, but I'm not verifying that code now, so the bugs stay.
|
|
|
|
Windows doesn't report network errors though errno, it has its own facilities.
|
|
It's not supported in mingw.
See https://github.com/TokTok/c-toxcore/issues/786.
|
|
|
|
This currently fails the nightly build.
|
|
|
|
|
|
|
|
|
|
This changes only code, no string literals or comments.
|
|
https://www.freebsd.org/cgi/man.cgi?alloca
If stdlib.h does not define alloca, and we're using GCC (or Clang), we
define the macro ourselves in terms of a GCC builtin.
|
|
This way, developers compile toxcore, toxav, and toxencryptsave as C++ at
least once at home, reducing the likelyhood of running into travis
failures where we compile as C++ in the windows build.
|
|
To make it an abstract type everywhere except in network.c.
|
|
Without these, we'll have a memory leak on error paths.
|
|
Based on #331.
Fixes #42.
|
|
|
|
|
|
|
|
|
|
|
|
This reverts commit 5ff099763b1f56414572e1c12eb2f003117db5a0.
|
|
This reverts commit 439f676d45d75f59f47a000a6adca8e9fe6a6e4e.
|
|
|
|
|
|
Found these missing includes while compiling on FreeBSD 11.
|
|
|