Conversation
59ba77e to
ea55a79
Compare
sudden6
left a comment
There was a problem hiding this comment.
Reviewable status: 0 of 1 approvals obtained (waiting on @iphydf)
toxav/toxav.h, line 748 at r1 (raw file):
*/ int toxav_add_av_groupchat(Tox *tox, void (*audio_callback)(void *, uint32_t, uint32_t, const int16_t *, unsigned int, uint8_t, uint32_t, void *),
make audio_callback a type?
toxav/toxav.c, line 188 at r1 (raw file):
msi_register_callback(av->msi, callback_capabilites, MSI_ON_CAPABILITIES); RETURN:
maybe call this one FAIL or EXIT? `return has a very specific meaning in C, so I think we should avoid that.
iphydf
left a comment
There was a problem hiding this comment.
Reviewable status: 1 change requests, 0 of 1 approvals obtained (waiting on @iphydf)
toxav/toxav.h, line 748 at r1 (raw file):
Previously, sudden6 wrote…
make
audio_callbacka type?
It is a type in groupav.h, but I don't want to expose it in the public api, because it's a non-sensical type. It says tox is a void pointer, when clearly it should be a Tox pointer. We can't fix this right now, so I'll fix it in 0.3.0. I've added a todo above.
toxav/toxav.c, line 188 at r1 (raw file):
Previously, sudden6 wrote…
maybe call this one
FAILorEXIT? `return has a very specific meaning in C, so I think we should avoid that.
I considered FAIL, but this is all the returns, not just the error returns. "exit" also has a specific meaning, namely to terminate the program. This is in fact jumping to the return statement, and since we're C, not C++, we have to actually spell out all the destructors that would normally be inserted at a real "return" statement.
Thoughts?
b270f2a to
e6beaf9
Compare
* Use Camel_Snake_Case for type names. * Use at least 4 characters for constant names. I.e. `END` is a type name, but `RETURN` is a constant name. This is because `DHT` is a type name (yay consistency). * Using `min_*` functions instead of MIN, we can avoid a cast. * Use `for`-loops for for-each-frame semantics instead of `while`. * Don't use assignments as expressions. * `++i` instead of `i++`. * Function pointers are dereferenced automatically, so no need to manually do so. * Avoid void pointers that lie about not being spaghetti code. Toxcore and toxav are both spaghetti and shouldn't pretend anything else. * Don't use empty statements (e.g. no `;;` anywhere in the code).
sudden6
left a comment
There was a problem hiding this comment.
Reviewed 2 of 3 files at r2.
Reviewable status: 1 change requests, 0 of 1 approvals obtained (waiting on @sudden6)
toxav/toxav.c, line 188 at r1 (raw file):
Previously, iphydf wrote…
I considered FAIL, but this is all the returns, not just the error returns. "exit" also has a specific meaning, namely to terminate the program. This is in fact jumping to the return statement, and since we're C, not C++, we have to actually spell out all the destructors that would normally be inserted at a real "return" statement.
Thoughts?
I have also seen CLEANUP being used for this, it would not clash with any C specific key words AFAIK, that we have to call all destructors ourself is unfortunate, I know...
Feel free to choose your preferred label, there probably isn't a single best solution.
sudden6
left a comment
There was a problem hiding this comment.
Reviewed 1 of 3 files at r2.
Reviewable status: 1 change requests, 0 of 1 approvals obtained (waiting on @iphydf)
ENDis a typename, but
RETURNis a constant name. This is becauseDHTis a typename (yay consistency).
min_*functions instead of MIN, we can avoid a cast.for-loops for for-each-frame semantics instead ofwhile.++iinstead ofi++.manually do so.
and toxav are both spaghetti and shouldn't pretend anything else.
;;anywhere in the code).This change is