Changeset 131 in libcf


Ignore:
Timestamp:
06/26/13 15:17:04 (11 years ago)
Author:
cheese
Message:

#1 modify assertion for bitwise

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/cf_bitwise.c

    r129 r131  
    1313#include <stdlib.h>
    1414
     15#define ASSERT_ARGS(x)  \
     16    if ((x))            \
     17        return CF_ERROR_BITWISE_INVALID_ARGS
    1518/**
    1619 * 비트열을 왼쪽으로 시프트
     
    3942    cf_byte buf = 0;
    4043
    41     if (!in || !out)
    42         return CF_ERROR_BITWISE_INVALID_ARGS;
     44    ASSERT_ARGS (!in || !out);
    4345
    4446    for (iter = 0 ; iter < remain ; iter++)
     
    8486    cf_byte buf = 0;
    8587
    86     if (!in || !out)
    87         return CF_ERROR_BITWISE_INVALID_ARGS;
     88    ASSERT_ARGS (!in || !out);
    8889
    8990    for (iter = 0 ; iter < remain ; iter++)
     
    123124    cf_byte * buf2 = NULL;
    124125
    125     if (!in || !out)
    126         return CF_ERROR_BITWISE_INVALID_ARGS;
     126    ASSERT_ARGS (!in || !out);
    127127
    128128    buf1 = (cf_byte *) calloc (size, 1);
     
    165165    cf_byte * buf2 = NULL;
    166166
    167     if (!in || !out)
    168         return CF_ERROR_BITWISE_INVALID_ARGS;
     167    ASSERT_ARGS (!in || !out);
    169168
    170169    buf1 = (cf_byte *) calloc (size, 1);
     
    206205    size_t  quota = size / 8;
    207206
    208     if (!in1 || !in2)
    209         return CF_ERROR_BITWISE_INVALID_ARGS;
     207    ASSERT_ARGS (!in1 || !in2 || !out);
    210208
    211209    for (iter = 0 ; iter < quota ; iter++)
     
    234232    size_t  quota = size / 8;
    235233
    236     if (!in1 || !in2)
    237         return CF_ERROR_BITWISE_INVALID_ARGS;
     234    ASSERT_ARGS (!in1 || !in2 || !out);
    238235
    239236    for (iter = 0 ; iter < quota ; iter++)
     
    262259    size_t  quota = size / 8;
    263260
    264     if (!in1 || !in2)
    265         return CF_ERROR_BITWISE_INVALID_ARGS;
     261    ASSERT_ARGS (!in1 || !in2 || !out);
    266262
    267263    for (iter = 0 ; iter < quota ; iter++)
Note: See TracChangeset for help on using the changeset viewer.