diff options
author | Andreas Schneider <mail@cynapses.org> | 2009-05-05 09:05:09 +0000 |
---|---|---|
committer | Andreas Schneider <mail@cynapses.org> | 2009-05-05 09:05:09 +0000 |
commit | 2e5f1c8955cb705db46e397703d16e46da2b11f8 (patch) | |
tree | 9d9c1a764e9cb39320da95f34a802df90637e3c6 /libssh | |
parent | 184b711a0471c23a45ffd2a25e41c5164e7dc43a (diff) | |
download | libssh-2e5f1c8955cb705db46e397703d16e46da2b11f8.tar.gz libssh-2e5f1c8955cb705db46e397703d16e46da2b11f8.tar.xz libssh-2e5f1c8955cb705db46e397703d16e46da2b11f8.zip |
Improve get_equals().
git-svn-id: svn+ssh://svn.berlios.de/svnroot/repos/libssh/trunk@739 7dcaeef0-15fb-0310-b436-a5af3365683c
Diffstat (limited to 'libssh')
-rw-r--r-- | libssh/base64.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/libssh/base64.c b/libssh/base64.c index 15636d73..42ee52bf 100644 --- a/libssh/base64.c +++ b/libssh/base64.c @@ -213,17 +213,18 @@ static int _base64_to_bin(unsigned char dest[3], const char *source, int num) { return 0; } -/* counts the number of "=" signs, and replace them by zeroes */ -static int get_equals(char *string){ - char *ptr=string; - int num=0; - while((ptr=strchr(ptr,'='))){ - num++; - *ptr=0; - ptr++; - } +/* Count the number of "=" signs and replace them by zeroes */ +static int get_equals(char *string) { + char *ptr = string; + int num = 0; + + while ((ptr=strchr(ptr,'=')) != NULL) { + num++; + *ptr = '\0'; + ptr++; + } - return num; + return num; } /* thanks sysk for debugging my mess :) */ |