-
Notifications
You must be signed in to change notification settings - Fork 168
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
code style #103
code style #103
Conversation
'if(' => 'if (': modified: containers/qvector.c modified: internal/qinternal.h modified: utilities/qhash.c
src/internal/qinternal.h
Outdated
@@ -41,15 +41,15 @@ | |||
size_t _strsize; \ | |||
for(_strsize = 1024; ; _strsize *= 2) { \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we want to style this the same way?
src/internal/qinternal.h
Outdated
@@ -41,15 +41,15 @@ | |||
size_t _strsize; \ | |||
for(_strsize = 1024; ; _strsize *= 2) { \ | |||
s = (char*)malloc(_strsize); \ | |||
if(s == NULL) { \ | |||
if (s == NULL) { \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we want the tailing \
lineup with other lines
thanks for the PR. I left a few comments. Have you checked other files? Are those the only files needing style adjustment? |
sorry clicked the wrong button. reopened. |
'while(' => 'while ('
Maybe we should style the comments too? If not, I think we're done. |
src/internal/qinternal.h
Outdated
@@ -39,17 +39,17 @@ | |||
|
|||
#define DYNAMIC_VSPRINTF(s, f) do { \ | |||
size_t _strsize; \ | |||
for(_strsize = 1024; ; _strsize *= 2) { \ | |||
for (_strsize = 1024; ; _strsize *= 2) { \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the tailing \
are off lining up with others.
src/internal/qinternal.h
Outdated
DEBUG("DYNAMIC_VSPRINTF(): can't allocate memory."); \ | ||
break; \ | ||
} \ | ||
va_list _arglist; \ | ||
va_start(_arglist, f); \ | ||
int _n = vsnprintf(s, _strsize, f, _arglist); \ | ||
va_end(_arglist); \ | ||
if(_n >= 0 && _n < _strsize) break; \ | ||
if (_n >= 0 && _n < _strsize) break; \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the tailing \
are off lining up with others here too. This is happening for many of the updates. Please check them again. Maybe easier to see it on the diff UI https://github.com/wolkykim/qlibc/pull/103/files
Fixed. Thanks for letting me know. Are the changes correct? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's your plan for other files? Are you going to work on applying this convention to all the other code and header files? Or partially only to those files included in this PR?
src/internal/qinternal.h
Outdated
#define Q_MUTEX_NEW(m,r) do { \ | ||
qmutex_t *x = (qmutex_t *)calloc(1, sizeof(qmutex_t)); \ | ||
pthread_mutexattr_t _mutexattr; \ | ||
pthread_mutexattr_init(&_mutexattr); \ | ||
if (r == true) { \ | ||
pthread_mutexattr_settype(&_mutexattr, PTHREAD_MUTEX_RECURSIVE); \ | ||
} \ | ||
int _ret = pthread_mutex_init(&(x->mutex), &_mutexattr); \ | ||
pthread_mutexattr_destroy(&_mutexattr); \ | ||
if(_ret == 0) { \ | ||
m = x; \ | ||
} else { \ | ||
DEBUG("Q_MUTEX: can't initialize mutex. [%d]", _ret); \ | ||
free(x); \ | ||
m = NULL; \ | ||
} \ | ||
} \ | ||
int _ret = pthread_mutex_init(&(x->mutex), &_mutexattr); \ | ||
pthread_mutexattr_destroy(&_mutexattr); \ | ||
if (_ret == 0) { \ | ||
m = x; \ | ||
} else { \ | ||
DEBUG("Q_MUTEX: can't initialize mutex. [%d]", _ret); \ | ||
free(x); \ | ||
m = NULL; \ | ||
} \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You only need to update L79 and L84.
I created the PR because I enjoy looking at qlibc code. I don't plan to apply this rule to any other files (though I will if you need to). Am I messing with qlibc code? |
That's nice. And no, you're not messing with the code but making it better. I appreciate your work. Yeah, making everything consistent would be nice but it's a large work. |
This is great. Just merged in. I'm looking forward to seeing more PRs like this. Thank you. |
Thank you for creating such a great library ^%^. |
I found other things that needed fixing, so I recreated the PR.
modified: 'if(' => 'if ('. Is okay?