diff options
| author | Masaki Muranaka <[email protected]> | 2012-10-30 14:25:00 +0900 |
|---|---|---|
| committer | Masaki Muranaka <[email protected]> | 2012-10-30 14:25:00 +0900 |
| commit | 30f7a93d415722ec070447d573355b2c67d71310 (patch) | |
| tree | 11c227532cddd5e992d7cf05ebd6d538f3939564 /src/dump.c | |
| parent | 509dbf9be8d65e855d0de304442be27b8b60d36b (diff) | |
| download | mruby-30f7a93d415722ec070447d573355b2c67d71310.tar.gz mruby-30f7a93d415722ec070447d573355b2c67d71310.zip | |
Use NULL instead of 0. (It is not a bug fix but a cosmetic change.)
Diffstat (limited to 'src/dump.c')
| -rw-r--r-- | src/dump.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/src/dump.c b/src/dump.c index 5100014d9..bdcb739b4 100644 --- a/src/dump.c +++ b/src/dump.c @@ -335,7 +335,7 @@ write_pool_block(mrb_state *mrb, mrb_irep *irep, char *buf, int type) uint16_t len =0; buf_size = MRB_DUMP_DEFAULT_STR_LEN; - if ((char_buf = (char *)mrb_malloc(mrb, buf_size)) == 0) + if ((char_buf = (char *)mrb_malloc(mrb, buf_size)) == NULL) goto error_exit; buf += uint32_dump((uint32_t)irep->plen, buf, type); /* number of pool */ @@ -358,7 +358,7 @@ write_pool_block(mrb_state *mrb, mrb_irep *irep, char *buf, int type) len = str_dump_len(RSTRING_PTR(str), RSTRING_LEN(str), type); if (len > buf_size - 1) { buf_size = len + 1; - if ((char_buf = (char *)mrb_realloc(mrb, char_buf, buf_size)) == 0) + if ((char_buf = (char *)mrb_realloc(mrb, char_buf, buf_size)) == NULL) goto error_exit; memset(char_buf, 0, buf_size); } @@ -371,7 +371,7 @@ write_pool_block(mrb_state *mrb, mrb_irep *irep, char *buf, int type) len = str_dump_len(RSTRING_PTR(str), RSTRING_LEN(str), type); if ( len > buf_size - 1) { buf_size = len + 1; - if ((char_buf = mrb_realloc(mrb, char_buf, buf_size)) == 0) + if ((char_buf = mrb_realloc(mrb, char_buf, buf_size)) == NULL) goto error_exit; memset(char_buf, 0, buf_size); } @@ -405,7 +405,7 @@ write_syms_block(mrb_state *mrb, mrb_irep *irep, char *buf, int type) uint16_t buf_size =0; buf_size = MRB_DUMP_DEFAULT_STR_LEN; - if ((char_buf = (char *)mrb_malloc(mrb, buf_size)) == 0) + if ((char_buf = (char *)mrb_malloc(mrb, buf_size)) == NULL) goto error_exit; buf += uint32_dump((uint32_t)irep->slen, buf, type); /* number of symbol */ @@ -421,7 +421,7 @@ write_syms_block(mrb_state *mrb, mrb_irep *irep, char *buf, int type) nlen = str_dump_len((char*)name, len, type); if ( nlen > buf_size - 1) { buf_size = nlen + 1; - if ((char_buf = (char *)mrb_realloc(mrb, char_buf, buf_size)) == 0) + if ((char_buf = (char *)mrb_realloc(mrb, char_buf, buf_size)) == NULL) goto error_exit; } memset(char_buf, 0, buf_size); @@ -457,7 +457,7 @@ calc_crc_section(mrb_state *mrb, mrb_irep *irep, uint16_t *crc, int section) default: return MRB_DUMP_GENERAL_FAILURE; } - if ((buf = (char *)mrb_calloc(mrb, 1, buf_size)) == 0) + if ((buf = (char *)mrb_calloc(mrb, 1, buf_size)) == NULL) return MRB_DUMP_GENERAL_FAILURE; buf_top = buf; @@ -542,7 +542,7 @@ write_irep_record(mrb_state *mrb, int irep_no, char* bin, uint32_t *rlen, int ty mrb_irep *irep = mrb->irep[irep_no]; int section; - if (irep == 0) + if (irep == NULL) return MRB_DUMP_INVALID_IREP; /* buf alloc */ @@ -586,7 +586,7 @@ dump_irep_record(mrb_state *mrb, int irep_no, FILE* fp, uint32_t *rlen) char *buf; mrb_irep *irep = mrb->irep[irep_no]; - if (irep == 0) + if (irep == NULL) return MRB_DUMP_INVALID_IREP; /* buf alloc */ @@ -594,7 +594,7 @@ dump_irep_record(mrb_state *mrb, int irep_no, FILE* fp, uint32_t *rlen) if (irep_record_size == 0) return MRB_DUMP_GENERAL_FAILURE; - if ((buf = (char *)mrb_calloc(mrb, 1, irep_record_size)) == 0) + if ((buf = (char *)mrb_calloc(mrb, 1, irep_record_size)) == NULL) return MRB_DUMP_GENERAL_FAILURE; if ((rc = write_irep_record(mrb, irep_no, buf, rlen, DUMP_TYPE_HEX)) != MRB_DUMP_OK) { @@ -620,7 +620,7 @@ mrb_write_irep(mrb_state *mrb, int top, char *bin) int irep_no; char *bin_top; - if (mrb == 0 || top < 0 || top >= mrb->irep_len || bin == 0) + if (mrb == NULL || top < 0 || top >= mrb->irep_len || bin == NULL) return MRB_DUMP_INVALID_ARGUMENT; bin_top = bin; @@ -648,7 +648,7 @@ mrb_dump_irep(mrb_state *mrb, int top, FILE* fp) uint32_t rlen=0; /* size of irep record */ int irep_no; - if (mrb == 0 || top < 0 || top >= mrb->irep_len || fp == 0) + if (mrb == NULL || top < 0 || top >= mrb->irep_len || fp == NULL) return MRB_DUMP_INVALID_ARGUMENT; if (fwrite(&def_rite_file_header, sizeof(rite_file_header), 1, fp) != 1) /* dummy write */ @@ -678,7 +678,7 @@ mrb_bdump_irep(mrb_state *mrb, int n, FILE *f,const char *initname) int buf_size = 0; int buf_idx = 0; - if (mrb == 0 || n < 0 || n >= mrb->irep_len || f == 0 || initname == 0) + if (mrb == NULL || n < 0 || n >= mrb->irep_len || f == NULL || initname == NULL) return -1; buf_size = sizeof(rite_binary_header) + MRB_DUMP_SIZE_OF_SHORT/* crc */; @@ -686,7 +686,7 @@ mrb_bdump_irep(mrb_state *mrb, int n, FILE *f,const char *initname) buf_size += get_irep_record_size(mrb, irep_no, DUMP_TYPE_BIN); buf_size += MRB_DUMP_SIZE_OF_LONG; /* end of file */ - if ((buf = (char *)mrb_malloc(mrb, buf_size)) == 0) + if ((buf = (char *)mrb_malloc(mrb, buf_size)) == NULL) return MRB_DUMP_GENERAL_FAILURE; rc = mrb_write_irep(mrb, n, buf); |
