Просмотр исходного кода

Merge pull request #151 from libtom/pr/adler32-declaration-block-beginning

move declarations at the block beginning (ANSI C)
karel-m 8 лет назад
Родитель
Сommit
b44aa8fa83
1 измененных файлов с 7 добавлено и 3 удалено
  1. 7 3
      src/misc/adler32.c

+ 7 - 3
src/misc/adler32.c

@@ -29,10 +29,12 @@ void adler32_init(adler32_state *ctx)
 
 
 void adler32_update(adler32_state *ctx, const unsigned char *input, unsigned long length)
 void adler32_update(adler32_state *ctx, const unsigned char *input, unsigned long length)
 {
 {
+   unsigned long s1, s2;
+
    LTC_ARGCHKVD(ctx != NULL);
    LTC_ARGCHKVD(ctx != NULL);
    LTC_ARGCHKVD(input != NULL);
    LTC_ARGCHKVD(input != NULL);
-   unsigned long s1 = ctx->s[0];
-   unsigned long s2 = ctx->s[1];
+   s1 = ctx->s[0];
+   s2 = ctx->s[1];
 
 
    if (length % 8 != 0) {
    if (length % 8 != 0) {
       do {
       do {
@@ -81,10 +83,12 @@ void adler32_update(adler32_state *ctx, const unsigned char *input, unsigned lon
 
 
 void adler32_finish(adler32_state *ctx, void *hash, unsigned long size)
 void adler32_finish(adler32_state *ctx, void *hash, unsigned long size)
 {
 {
+   unsigned char* h;
+
    LTC_ARGCHKVD(ctx != NULL);
    LTC_ARGCHKVD(ctx != NULL);
    LTC_ARGCHKVD(hash != NULL);
    LTC_ARGCHKVD(hash != NULL);
 
 
-   unsigned char* h = hash;
+   h = hash;
 
 
    switch (size) {
    switch (size) {
       default:
       default: