diff options
author | Paolo Bonzini <bonzini@gnu.org> | 2012-03-16 09:10:57 +0100 |
---|---|---|
committer | Paolo Bonzini <bonzini@gnu.org> | 2012-03-16 09:43:02 +0100 |
commit | 40c84e138affdc72744d8619203b28768613ab32 (patch) | |
tree | 2d4fae4887064b527402eea02ab27da3d53381db /sed | |
parent | 32d990dd60cef9fc129cb37ab2bec72b529e911d (diff) | |
download | sed-40c84e138affdc72744d8619203b28768613ab32.tar.gz |
rip out old macros
2012-03-16 Paolo Bonzini <bonzini@gnu.org>
* basicdefs.h (CAST, VCAST, VOID, MEMCPY, MEMMOVE): Rip out.
* sed/compile.c: Adjust.
* sed/execute.c: Adjust.
* sed/regexp.c: Adjust.
* sed/utils.c: Adjust.
* sed/utils.h: Adjust.
Diffstat (limited to 'sed')
-rw-r--r-- | sed/compile.c | 22 | ||||
-rw-r--r-- | sed/execute.c | 40 | ||||
-rw-r--r-- | sed/regexp.c | 4 | ||||
-rw-r--r-- | sed/utils.c | 22 | ||||
-rw-r--r-- | sed/utils.h | 14 |
5 files changed, 51 insertions, 51 deletions
diff --git a/sed/compile.c b/sed/compile.c index cf3b32b..40b67ca 100644 --- a/sed/compile.c +++ b/sed/compile.c @@ -190,12 +190,12 @@ bad_prog(why) { if (cur_input.name) fprintf(stderr, _("%s: file %s line %lu: %s\n"), - myname, cur_input.name, CAST(unsigned long)cur_input.line, why); + myname, cur_input.name, (unsigned long)cur_input.line, why); else fprintf(stderr, _("%s: -e expression #%lu, char %lu: %s\n"), myname, - CAST(unsigned long)cur_input.string_expr_count, - CAST(unsigned long)(prog.cur-prog.base), + (unsigned long)cur_input.string_expr_count, + (unsigned long)(prog.cur-prog.base), why); exit(EXIT_FAILURE); } @@ -239,7 +239,7 @@ savchar(ch) { if (prog.cur <= prog.base || *--prog.cur != ch) panic("Called savchar() with unexpected pushback (%x)", - CAST(unsigned char)ch); + (unsigned char)ch); } else ungetc(ch, prog.file); @@ -707,7 +707,7 @@ setup_label(list, idx, name, err_info) ret->v_index = idx; ret->name = name; if (err_info) - MEMCPY(&ret->err_info, err_info, sizeof (ret->err_info)); + memcpy(&ret->err_info, err_info, sizeof (ret->err_info)); ret->next = list; return ret; } @@ -778,7 +778,7 @@ setup_replacement(sub, text, length) { /* Preceding the backslash may be some literal text: */ tail = tail->next = - new_replacement(base, CAST(size_t)(p - base), repl_type); + new_replacement(base, (size_t)(p - base), repl_type); repl_type = save_type; @@ -840,7 +840,7 @@ setup_replacement(sub, text, length) { /* Preceding the ampersand may be some literal text: */ tail = tail->next = - new_replacement(base, CAST(size_t)(p - base), repl_type); + new_replacement(base, (size_t)(p - base), repl_type); repl_type = save_type; tail->subst_id = 0; @@ -850,7 +850,7 @@ setup_replacement(sub, text, length) /* There may be some trailing literal text: */ if (base < text_end) tail = tail->next = - new_replacement(base, CAST(size_t)(text_end - base), repl_type); + new_replacement(base, (size_t)(text_end - base), repl_type); tail->next = NULL; sub->replacement = root.next; @@ -1354,7 +1354,7 @@ compile_program(vector) { unsigned char *translate = OB_MALLOC(&obs, YMAP_LENGTH, unsigned char); - unsigned char *ustring = CAST(unsigned char *)src_buf; + unsigned char *ustring = (unsigned char *)src_buf; if (len != dest_len) bad_prog(_(Y_CMD_LEN)); @@ -1563,7 +1563,7 @@ compile_string(cur_program, str, len) struct vector *ret; prog.file = NULL; - prog.base = CAST(unsigned char *)str; + prog.base = (unsigned char *)str; prog.cur = prog.base; prog.end = prog.cur + len; @@ -1627,7 +1627,7 @@ check_final_program(program) if (blocks) { /* update info for error reporting: */ - MEMCPY(&cur_input, &blocks->err_info, sizeof (cur_input)); + memcpy(&cur_input, &blocks->err_info, sizeof (cur_input)); bad_prog(_(EXCESS_OPEN_BRACE)); } diff --git a/sed/execute.c b/sed/execute.c index b409448..ae19741 100644 --- a/sed/execute.c +++ b/sed/execute.c @@ -145,7 +145,7 @@ resize_line(lb, len) * remove it. */ if (inactive > lb->alloc * 2) { - MEMMOVE(lb->text, lb->active, lb->length); + memmove(lb->text, lb->active, lb->length); lb->alloc += lb->active - lb->text; lb->active = lb->text; inactive = 0; @@ -176,7 +176,7 @@ str_append(to, string, length) if (to->alloc < new_length) resize_line(to, new_length); - MEMCPY(to->active + to->length, string, length); + memcpy(to->active + to->length, string, length); to->length = new_length; if (mb_cur_max > 1 && !is_utf8) @@ -221,7 +221,7 @@ str_append_modified(to, string, length, type) if (to->alloc - to->length < length * mb_cur_max) resize_line(to, to->length + length * mb_cur_max); - MEMCPY (&from_stat, &to->mbstate, sizeof(mbstate_t)); + memcpy (&from_stat, &to->mbstate, sizeof(mbstate_t)); while (length) { wchar_t wc; @@ -346,10 +346,10 @@ line_copy(from, to, state) to->active = to->text; to->length = from->length; to->chomped = from->chomped; - MEMCPY(to->active, from->active, from->length); + memcpy(to->active, from->active, from->length); if (state) - MEMCPY(&to->mbstate, &from->mbstate, sizeof (from->mbstate)); + memcpy(&to->mbstate, &from->mbstate, sizeof (from->mbstate)); } /* Append the contents of the line `from' to the line `to'. @@ -366,7 +366,7 @@ line_append(from, to, state) to->chomped = from->chomped; if (state) - MEMCPY (&to->mbstate, &from->mbstate, sizeof (from->mbstate)); + memcpy (&to->mbstate, &from->mbstate, sizeof (from->mbstate)); } /* Exchange two "struct line" buffers. @@ -382,15 +382,15 @@ line_exchange(a, b, state) if (state) { - MEMCPY(&t, a, sizeof (struct line)); - MEMCPY( a, b, sizeof (struct line)); - MEMCPY( b, &t, sizeof (struct line)); + memcpy(&t, a, sizeof (struct line)); + memcpy( a, b, sizeof (struct line)); + memcpy( b, &t, sizeof (struct line)); } else { - MEMCPY(&t, a, SIZEOF_LINE); - MEMCPY( a, b, SIZEOF_LINE); - MEMCPY( b, &t, SIZEOF_LINE); + memcpy(&t, a, SIZEOF_LINE); + memcpy( a, b, SIZEOF_LINE); + memcpy( b, &t, SIZEOF_LINE); } } @@ -565,7 +565,7 @@ get_backup_file_name(name) (asterisk = strchr(old_asterisk, '*')); old_asterisk = asterisk + 1) { - MEMCPY (p, old_asterisk, asterisk - old_asterisk); + memcpy (p, old_asterisk, asterisk - old_asterisk); p += asterisk - old_asterisk; strcpy (p, name); p += name_length; @@ -954,7 +954,7 @@ static void do_list(line_len) int line_len; { - unsigned char *p = CAST(unsigned char *)line.active; + unsigned char *p = (unsigned char *)line.active; countT len = line.length; countT width = 0; char obuf[180]; /* just in case we encounter a 512-bit char (;-) */ @@ -1050,7 +1050,7 @@ append_replacement (buf, p, regs) else if (regs->end[i] != regs->start[i]) str_append_modified(buf, line.active + regs->start[i], - CAST(size_t)(regs->end[i] - regs->start[i]), + (size_t)(regs->end[i] - regs->start[i]), curr_type); } } @@ -1253,15 +1253,15 @@ shrink_program(vec, cur_cmd) for (p=v; p < cur_cmd; ++p) if (p->cmd != '#') - MEMCPY(v++, p, sizeof *v); + memcpy(v++, p, sizeof *v); cmd_cnt = v - vec->v; for (; p < last_cmd; ++p) if (p->cmd != '#') - MEMCPY(v++, p, sizeof *v); + memcpy(v++, p, sizeof *v); vec->v_length = v - vec->v; - return (0 < vec->v_length) ? (vec->v + cmd_cnt) : CAST(struct sed_cmd *)0; + return (0 < vec->v_length) ? (vec->v + cmd_cnt) : (struct sed_cmd *)0; } #endif /*EXPERIMENTAL_DASH_N_OPTIMIZATION*/ @@ -1621,7 +1621,7 @@ execute_program(vec, input) else { unsigned char *p, *e; - p = CAST(unsigned char *)line.active; + p = (unsigned char *)line.active; for (e=p+line.length; p<e; ++p) *p = cur_cmd->x.translate[*p]; } @@ -1635,7 +1635,7 @@ execute_program(vec, input) case '=': output_missing_newline(&output_file); fprintf(output_file.fp, "%lu\n", - CAST(unsigned long)input->line_number); + (unsigned long)input->line_number); flush_output(output_file.fp); break; diff --git a/sed/regexp.c b/sed/regexp.c index 74cee00..6477f7f 100644 --- a/sed/regexp.c +++ b/sed/regexp.c @@ -233,8 +233,8 @@ match_regex(regex, buf, buflen, buf_start_offset, regarray, regsize) regex_last = regex; #ifdef REG_PERL - regmatch[0].rm_so = CAST(int)buf_start_offset; - regmatch[0].rm_eo = CAST(int)buflen; + regmatch[0].rm_so = (int)buf_start_offset; + regmatch[0].rm_eo = (int)buflen; ret = regexec (®ex->pattern, buf, regsize, regmatch, REG_STARTEND); if (regsize) diff --git a/sed/utils.c b/sed/utils.c index 3db737b..8fc9b35 100644 --- a/sed/utils.c +++ b/sed/utils.c @@ -219,7 +219,7 @@ ck_mkstemp (p_filename, tmpdir, base, mode) /* Panic on failing fwrite */ void ck_fwrite(ptr, size, nmemb, stream) - const VOID *ptr; + const void *ptr; size_t size; size_t nmemb; FILE *stream; @@ -234,7 +234,7 @@ ck_fwrite(ptr, size, nmemb, stream) /* Panic on failing fread */ size_t ck_fread(ptr, size, nmemb, stream) - VOID *ptr; + void *ptr; size_t size; size_t nmemb; FILE *stream; @@ -441,23 +441,23 @@ ck_rename (from, to, unlink_if_fail) /* Panic on failing malloc */ -VOID * +void * ck_malloc(size) size_t size; { - VOID *ret = calloc(1, size ? size : 1); + void *ret = calloc(1, size ? size : 1); if (!ret) panic("couldn't allocate memory"); return ret; } /* Panic on failing realloc */ -VOID * +void * ck_realloc(ptr, size) - VOID *ptr; + void *ptr; size_t size; { - VOID *ret; + void *ret; if (size == 0) { @@ -482,19 +482,19 @@ ck_strdup(str) } /* Return a malloc()'d copy of a block of memory */ -VOID * +void * ck_memdup(buf, len) - const VOID *buf; + const void *buf; size_t len; { - VOID *ret = ck_malloc(len); + void *ret = ck_malloc(len); return memcpy(ret, buf, len); } /* Release a malloc'd block of memory */ void ck_free(ptr) - VOID *ptr; + void *ptr; { if (ptr) free(ptr); diff --git a/sed/utils.h b/sed/utils.h index 9132e3d..34b1d7e 100644 --- a/sed/utils.h +++ b/sed/utils.h @@ -24,8 +24,8 @@ void panic P_((const char *str, ...)); FILE *ck_fopen P_((const char *name, const char *mode, int fail)); FILE *ck_fdopen P_((int fd, const char *name, const char *mode, int fail)); -void ck_fwrite P_((const VOID *ptr, size_t size, size_t nmemb, FILE *stream)); -size_t ck_fread P_((VOID *ptr, size_t size, size_t nmemb, FILE *stream)); +void ck_fwrite P_((const void *ptr, size_t size, size_t nmemb, FILE *stream)); +size_t ck_fread P_((void *ptr, size_t size, size_t nmemb, FILE *stream)); void ck_fflush P_((FILE *stream)); void ck_fclose P_((FILE *stream)); const char *follow_symlink P_((const char *path)); @@ -34,12 +34,12 @@ FILE * ck_mkstemp P_((char **p_filename, const char *tmpdir, const char *base, const char *mode)); void ck_rename P_((const char *from, const char *to, const char *unlink_if_fail)); -VOID *ck_malloc P_((size_t size)); -VOID *xmalloc P_((size_t size)); -VOID *ck_realloc P_((VOID *ptr, size_t size)); +void *ck_malloc P_((size_t size)); +void *xmalloc P_((size_t size)); +void *ck_realloc P_((void *ptr, size_t size)); char *ck_strdup P_((const char *str)); -VOID *ck_memdup P_((const VOID *buf, size_t len)); -void ck_free P_((VOID *ptr)); +void *ck_memdup P_((const void *buf, size_t len)); +void ck_free P_((void *ptr)); struct buffer *init_buffer P_((void)); char *get_buffer P_((struct buffer *b)); |