From: Jay Krell Date: Mon, 19 Feb 2018 11:42:25 +0000 (-0800) Subject: Eliminate C++ warning about deprecated register keyword (cord) X-Git-Tag: v8.0.0~336 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4b76d1539641df88da5c1dedc8f741e69b32f21c;p=platform%2Fupstream%2Flibgc.git Eliminate C++ warning about deprecated register keyword (cord) Issue #206 (bdwgc). * cord/cordbscs.c (CORD_dump_inner, CORD_cat_char_star, CORD_cat, CORD_from_fn_inner, CORD_index_access_fn, CORD_apply_access_fn, CORD_substr_closure, CORD_substr_checked, CORD_substr, CORD_iter5, CORD_riter4, CORD_init_min_len, CORD_init_forest, CORD_add_forest, CORD_concat_forest, CORD_balance_insert, CORD_balance, CORD__extend_path, CORD__pos_fetch, CORD__next, CORD__prev, CORD_pos_fetch: Remove register keyword for local variables (and function parameters). * cord/cordprnt.c (extract_conv_spec, CORD_vsprintf): Likewise. * cord/cordxtra.c (CORD_cat_char, CORD_catn, CORD_fill_proc, CORD_batched_fill_proc, CORD_cmp, CORD_ncmp, CORD_to_char_star, CORD_put_proc, CORD_batched_put_proc, CORD_chr_proc, CORD_rchr_proc, CORD_batched_chr_proc, CORD_str, CORD_ec_flush_buf, CORD_from_file_eager, refill_cache, CORD_lf_func, CORD_from_file_lazy_inner, CORD_from_file_lazy, CORD_from_file): Likewise. * cord/tests/cordtest.c (test_basics, test_extras): Likewise. * cord/tests/de.c (retrieve_line, redisplay): Likewise. * cord/tests/de_win.c (plain_chars, control_chars, WndProc): Likewise. --- diff --git a/cord/cordbscs.c b/cord/cordbscs.c index a576478..9e6c8ab 100644 --- a/cord/cordbscs.c +++ b/cord/cordbscs.c @@ -114,7 +114,7 @@ typedef union { /* indentation level n. */ void CORD_dump_inner(CORD x, unsigned n) { - register size_t i; + size_t i; for (i = 0; i < (size_t)n; i++) { fputs(" ", stdout); @@ -129,15 +129,15 @@ void CORD_dump_inner(CORD x, unsigned n) if (x[i] != '\0') fputs("...", stdout); putchar('\n'); } else if (IS_CONCATENATION(x)) { - register struct Concatenation * conc = - &(((CordRep *)x) -> concatenation); + struct Concatenation * conc = &(((CordRep *)x) -> concatenation); + printf("Concatenation: %p (len: %d, depth: %d)\n", (void *)x, (int)(conc -> len), (int)(conc -> depth)); CORD_dump_inner(conc -> left, n+1); CORD_dump_inner(conc -> right, n+1); - } else /* function */{ - register struct Function * func = - &(((CordRep *)x) -> function); + } else /* function */ { + struct Function * func = &(((CordRep *)x) -> function); + if (IS_SUBSTR(x)) printf("(Substring) "); printf("Function: %p (len: %d): ", (void *)x, (int)(func -> len)); for (i = 0; i < 20 && i < func -> len; i++) { @@ -157,9 +157,9 @@ void CORD_dump(CORD x) CORD CORD_cat_char_star(CORD x, const char * y, size_t leny) { - register size_t result_len; - register size_t lenx; - register int depth; + size_t result_len; + size_t lenx; + int depth; if (x == CORD_EMPTY) return(y); if (leny == 0) return(x); @@ -178,9 +178,9 @@ CORD CORD_cat_char_star(CORD x, const char * y, size_t leny) depth = 1; } } else { - register CORD right; - register CORD left; - register char * new_right; + CORD right; + CORD left; + char * new_right; lenx = LEN(x); @@ -222,10 +222,9 @@ CORD CORD_cat_char_star(CORD x, const char * y, size_t leny) } { /* The general case; lenx, result_len is known: */ - register struct Concatenation * result; + struct Concatenation * result = GC_NEW(struct Concatenation); - result = GC_NEW(struct Concatenation); - if (result == 0) OUT_OF_MEMORY; + if (NULL == result) OUT_OF_MEMORY; result->header = CONCAT_HDR; result->depth = (char)depth; if (lenx <= MAX_LEFT_LEN) @@ -244,9 +243,9 @@ CORD CORD_cat_char_star(CORD x, const char * y, size_t leny) CORD CORD_cat(CORD x, CORD y) { - register size_t result_len; - register int depth; - register size_t lenx; + size_t result_len; + int depth; + size_t lenx; if (x == CORD_EMPTY) return(y); if (y == CORD_EMPTY) return(x); @@ -256,7 +255,7 @@ CORD CORD_cat(CORD x, CORD y) lenx = strlen(x); depth = DEPTH(y) + 1; } else { - register int depthy = DEPTH(y); + int depthy = DEPTH(y); lenx = LEN(x); depth = DEPTH(x) + 1; @@ -264,10 +263,9 @@ CORD CORD_cat(CORD x, CORD y) } result_len = lenx + LEN(y); { - register struct Concatenation * result; + struct Concatenation * result = GC_NEW(struct Concatenation); - result = GC_NEW(struct Concatenation); - if (result == 0) OUT_OF_MEMORY; + if (NULL == result) OUT_OF_MEMORY; result->header = CONCAT_HDR; result->depth = (char)depth; if (lenx <= MAX_LEFT_LEN) @@ -288,8 +286,8 @@ static CordRep *CORD_from_fn_inner(CORD_fn fn, void * client_data, size_t len) { if (len == 0) return(0); if (len <= SHORT_LIMIT) { - register char * result; - register size_t i; + char * result; + size_t i; char buf[SHORT_LIMIT+1]; for (i = 0; i < len; i++) { @@ -307,10 +305,9 @@ static CordRep *CORD_from_fn_inner(CORD_fn fn, void * client_data, size_t len) } gen_case: { - register struct Function * result; + struct Function * result = GC_NEW(struct Function); - result = GC_NEW(struct Function); - if (result == 0) OUT_OF_MEMORY; + if (NULL == result) OUT_OF_MEMORY; result->header = FN_HDR; /* depth is already 0 */ result->len = (word)len; @@ -341,15 +338,15 @@ struct substr_args { char CORD_index_access_fn(size_t i, void * client_data) { - register struct substr_args *descr = (struct substr_args *)client_data; + struct substr_args *descr = (struct substr_args *)client_data; return(((char *)(descr->sa_cord))[i + descr->sa_index]); } char CORD_apply_access_fn(size_t i, void * client_data) { - register struct substr_args *descr = (struct substr_args *)client_data; - register struct Function * fn_cord = &(descr->sa_cord->function); + struct substr_args *descr = (struct substr_args *)client_data; + struct Function * fn_cord = &(descr->sa_cord->function); return((*(fn_cord->fn))(i + descr->sa_index, fn_cord->client_data)); } @@ -360,7 +357,7 @@ char CORD_apply_access_fn(size_t i, void * client_data) /* Assumes i >= 0 and i + n < length(x). */ CORD CORD_substr_closure(CORD x, size_t i, size_t n, CORD_fn f) { - register struct substr_args * sa = GC_NEW(struct substr_args); + struct substr_args * sa = GC_NEW(struct substr_args); CordRep * result; if (sa == 0) OUT_OF_MEMORY; @@ -392,13 +389,10 @@ CORD CORD_substr_checked(CORD x, size_t i, size_t n) return(result); } } else if (IS_CONCATENATION(x)) { - register struct Concatenation * conc - = &(((CordRep *)x) -> concatenation); - register size_t left_len; - register size_t right_len; + struct Concatenation * conc = &(((CordRep *)x) -> concatenation); + size_t left_len = LEFT_LEN(conc); + size_t right_len = conc -> len - left_len; - left_len = LEFT_LEN(conc); - right_len = conc -> len - left_len; if (i >= left_len) { if (n == right_len) return(conc -> right); return(CORD_substr_checked(conc -> right, i - left_len, n)); @@ -407,9 +401,9 @@ CORD CORD_substr_checked(CORD x, size_t i, size_t n) return(CORD_substr_checked(conc -> left, i, n)); } else { /* Need at least one character from each side. */ - register CORD left_part; - register CORD right_part; - register size_t left_part_len = left_len - i; + CORD left_part; + CORD right_part; + size_t left_part_len = left_len - i; if (i == 0) { left_part = conc -> left; @@ -428,8 +422,8 @@ CORD CORD_substr_checked(CORD x, size_t i, size_t n) if (n > SUBSTR_LIMIT) { if (IS_SUBSTR(x)) { /* Avoid nesting substring nodes. */ - register struct Function * f = &(((CordRep *)x) -> function); - register struct substr_args *descr = + struct Function * f = &(((CordRep *)x) -> function); + struct substr_args *descr = (struct substr_args *)(f -> client_data); return(CORD_substr_closure((CORD)descr->sa_cord, @@ -440,11 +434,11 @@ CORD CORD_substr_checked(CORD x, size_t i, size_t n) } } else { char * result; - register struct Function * f = &(((CordRep *)x) -> function); + struct Function * f = &(((CordRep *)x) -> function); char buf[SUBSTR_LIMIT+1]; - register char * p = buf; - register size_t j; - register size_t lim = i + n; + char * p = buf; + size_t j; + size_t lim = i + n; for (j = i; j < lim; j++) { char c = (*(f -> fn))(j, f -> client_data); @@ -465,7 +459,7 @@ CORD CORD_substr_checked(CORD x, size_t i, size_t n) CORD CORD_substr(CORD x, size_t i, size_t n) { - register size_t len = CORD_len(x); + size_t len = CORD_len(x); if (i >= len || n == 0) return(0); if (i + n > len) n = len - i; @@ -478,7 +472,7 @@ int CORD_iter5(CORD x, size_t i, CORD_iter_fn f1, { if (x == 0) return(0); if (CORD_IS_STRING(x)) { - register const char *p = x+i; + const char *p = x+i; if (*p == '\0') ABORT("2nd arg to CORD_iter5 too big"); if (f2 != CORD_NO_FN) { @@ -491,12 +485,10 @@ int CORD_iter5(CORD x, size_t i, CORD_iter_fn f1, return(0); } } else if (IS_CONCATENATION(x)) { - register struct Concatenation * conc - = &(((CordRep *)x) -> concatenation); - + struct Concatenation * conc = &(((CordRep *)x) -> concatenation); if (i > 0) { - register size_t left_len = LEFT_LEN(conc); + size_t left_len = LEFT_LEN(conc); if (i >= left_len) { return(CORD_iter5(conc -> right, i - left_len, f1, f2, @@ -508,9 +500,9 @@ int CORD_iter5(CORD x, size_t i, CORD_iter_fn f1, } return(CORD_iter5(conc -> right, 0, f1, f2, client_data)); } else /* function */ { - register struct Function * f = &(((CordRep *)x) -> function); - register size_t j; - register size_t lim = f -> len; + struct Function * f = &(((CordRep *)x) -> function); + size_t j; + size_t lim = f -> len; for (j = i; j < lim; j++) { if ((*f1)((*(f -> fn))(j, f -> client_data), client_data)) { @@ -531,7 +523,7 @@ int CORD_riter4(CORD x, size_t i, CORD_iter_fn f1, void * client_data) { if (x == 0) return(0); if (CORD_IS_STRING(x)) { - register const char *p = x + i; + const char *p = x + i; for(;;) { char c = *p; @@ -543,12 +535,10 @@ int CORD_riter4(CORD x, size_t i, CORD_iter_fn f1, void * client_data) } return(0); } else if (IS_CONCATENATION(x)) { - register struct Concatenation * conc - = &(((CordRep *)x) -> concatenation); - register CORD left_part = conc -> left; - register size_t left_len; + struct Concatenation * conc = &(((CordRep *)x) -> concatenation); + CORD left_part = conc -> left; + size_t left_len = LEFT_LEN(conc); - left_len = LEFT_LEN(conc); if (i >= left_len) { if (CORD_riter4(conc -> right, i - left_len, f1, client_data)) { return(1); @@ -558,8 +548,8 @@ int CORD_riter4(CORD x, size_t i, CORD_iter_fn f1, void * client_data) return(CORD_riter4(left_part, i, f1, client_data)); } } else /* function */ { - register struct Function * f = &(((CordRep *)x) -> function); - register size_t j; + struct Function * f = &(((CordRep *)x) -> function); + size_t j; for (j = i; ; j--) { if ((*f1)((*(f -> fn))(j, f -> client_data), client_data)) { @@ -611,7 +601,7 @@ typedef ForestElement Forest [ MAX_DEPTH ]; void CORD_init_min_len(void) { - register int i; + int i; size_t last, previous; min_len[0] = previous = 1; @@ -631,7 +621,7 @@ void CORD_init_min_len(void) void CORD_init_forest(ForestElement * forest, size_t max_len) { - register int i; + int i; for (i = 0; i < MAX_DEPTH; i++) { forest[i].c = 0; @@ -647,9 +637,9 @@ void CORD_init_forest(ForestElement * forest, size_t max_len) /* This node should not be counted in the statement of the invariants. */ void CORD_add_forest(ForestElement * forest, CORD x, size_t len) { - register int i = 0; - register CORD sum = CORD_EMPTY; - register size_t sum_len = 0; + int i = 0; + CORD sum = CORD_EMPTY; + size_t sum_len = 0; while (len > min_len[i + 1]) { if (forest[i].c != 0) { @@ -683,7 +673,7 @@ void CORD_add_forest(ForestElement * forest, CORD x, size_t len) CORD CORD_concat_forest(ForestElement * forest, size_t expected_len) { - register int i = 0; + int i = 0; CORD sum = 0; size_t sum_len = 0; @@ -702,15 +692,14 @@ CORD CORD_concat_forest(ForestElement * forest, size_t expected_len) /* of the final tree. */ void CORD_balance_insert(CORD x, size_t len, ForestElement * forest) { - register int depth; + int depth; if (CORD_IS_STRING(x)) { CORD_add_forest(forest, x, len); } else if (IS_CONCATENATION(x) && ((depth = DEPTH(x)) >= MAX_DEPTH || len < min_len[depth])) { - register struct Concatenation * conc - = &(((CordRep *)x) -> concatenation); + struct Concatenation * conc = &(((CordRep *)x) -> concatenation); size_t left_len = LEFT_LEN(conc); CORD_balance_insert(conc -> left, left_len, forest); @@ -724,7 +713,7 @@ void CORD_balance_insert(CORD x, size_t len, ForestElement * forest) CORD CORD_balance(CORD x) { Forest forest; - register size_t len; + size_t len; if (x == 0) return(0); if (CORD_IS_STRING(x)) return(x); @@ -743,19 +732,18 @@ CORD CORD_balance(CORD x) /* P contains a prefix of the path to cur_pos. Extend it to a full */ /* path and set up leaf info. */ /* Return 0 if past the end of cord, 1 o.w. */ -void CORD__extend_path(register CORD_pos p) +void CORD__extend_path(CORD_pos p) { - register struct CORD_pe * current_pe = &(p[0].path[p[0].path_len]); - register CORD top = current_pe -> pe_cord; - register size_t pos = p[0].cur_pos; - register size_t top_pos = current_pe -> pe_start_pos; - register size_t top_len = GEN_LEN(top); + struct CORD_pe * current_pe = &(p[0].path[p[0].path_len]); + CORD top = current_pe -> pe_cord; + size_t pos = p[0].cur_pos; + size_t top_pos = current_pe -> pe_start_pos; + size_t top_len = GEN_LEN(top); /* Fill in the rest of the path. */ while(!CORD_IS_STRING(top) && IS_CONCATENATION(top)) { - register struct Concatenation * conc = - &(((CordRep *)top) -> concatenation); - register size_t left_len; + struct Concatenation * conc = &(((CordRep *)top) -> concatenation); + size_t left_len; left_len = LEFT_LEN(conc); current_pe++; @@ -781,37 +769,37 @@ void CORD__extend_path(register CORD_pos p) if (pos >= top_pos + top_len) p[0].path_len = CORD_POS_INVALID; } -char CORD__pos_fetch(register CORD_pos p) +char CORD__pos_fetch(CORD_pos p) { /* Leaf is a function node */ struct CORD_pe * pe = &((p)[0].path[(p)[0].path_len]); CORD leaf = pe -> pe_cord; - register struct Function * f = &(((CordRep *)leaf) -> function); + struct Function * f = &(((CordRep *)leaf) -> function); if (!IS_FUNCTION(leaf)) ABORT("CORD_pos_fetch: bad leaf"); return ((*(f -> fn))(p[0].cur_pos - pe -> pe_start_pos, f -> client_data)); } -void CORD__next(register CORD_pos p) +void CORD__next(CORD_pos p) { - register size_t cur_pos = p[0].cur_pos + 1; - register struct CORD_pe * current_pe = &((p)[0].path[(p)[0].path_len]); - register CORD leaf = current_pe -> pe_cord; + size_t cur_pos = p[0].cur_pos + 1; + struct CORD_pe * current_pe = &((p)[0].path[(p)[0].path_len]); + CORD leaf = current_pe -> pe_cord; /* Leaf is not a string or we're at end of leaf */ p[0].cur_pos = cur_pos; if (!CORD_IS_STRING(leaf)) { /* Function leaf */ - register struct Function * f = &(((CordRep *)leaf) -> function); - register size_t start_pos = current_pe -> pe_start_pos; - register size_t end_pos = start_pos + f -> len; + struct Function * f = &(((CordRep *)leaf) -> function); + size_t start_pos = current_pe -> pe_start_pos; + size_t end_pos = start_pos + f -> len; if (cur_pos < end_pos) { /* Fill cache and return. */ - register size_t i; - register size_t limit = cur_pos + FUNCTION_BUF_SZ; - register CORD_fn fn = f -> fn; - register void * client_data = f -> client_data; + size_t i; + size_t limit = cur_pos + FUNCTION_BUF_SZ; + CORD_fn fn = f -> fn; + void * client_data = f -> client_data; if (limit > end_pos) { limit = end_pos; @@ -844,9 +832,9 @@ void CORD__next(register CORD_pos p) CORD__extend_path(p); } -void CORD__prev(register CORD_pos p) +void CORD__prev(CORD_pos p) { - register struct CORD_pe * pe = &(p[0].path[p[0].path_len]); + struct CORD_pe * pe = &(p[0].path[p[0].path_len]); if (p[0].cur_pos == 0) { p[0].path_len = CORD_POS_INVALID; @@ -860,7 +848,7 @@ void CORD__prev(register CORD_pos p) /* Pop the stack until we find two concatenation nodes with the */ /* different start position: this implies we were in right part. */ { - register struct CORD_pe * current_pe = &((p)[0].path[(p)[0].path_len]); + struct CORD_pe * current_pe = &((p)[0].path[(p)[0].path_len]); while (p[0].path_len > 0 && current_pe[0].pe_start_pos == current_pe[-1].pe_start_pos) { @@ -879,7 +867,7 @@ void CORD__prev(register CORD_pos p) #undef CORD_pos_to_cord #undef CORD_pos_valid -char CORD_pos_fetch(register CORD_pos p) +char CORD_pos_fetch(CORD_pos p) { if (p[0].cur_end != 0) { return(p[0].cur_leaf[p[0].cur_pos - p[0].cur_start]); diff --git a/cord/cordprnt.c b/cord/cordprnt.c index 80454a0..cfe1de4 100644 --- a/cord/cordprnt.c +++ b/cord/cordprnt.c @@ -70,12 +70,12 @@ static int ec_len(CORD_ec x) static int extract_conv_spec(CORD_pos source, char *buf, int * width, int *prec, int *left, int * long_arg) { - register int result = 0; - register int current_number = 0; - register int saw_period = 0; - register int saw_number = 0; - register int chars_so_far = 0; - register char current; + int result = 0; + int current_number = 0; + int saw_period = 0; + int saw_number = 0; + int chars_so_far = 0; + char current; *width = NONE; buf[chars_so_far++] = '%'; @@ -191,8 +191,8 @@ static int extract_conv_spec(CORD_pos source, char *buf, int CORD_vsprintf(CORD * out, CORD format, va_list args) { CORD_ec result; - register int count; - register char current; + int count; + char current; CORD_pos pos; char conv_spec[CONV_SPEC_LEN + 1]; @@ -263,7 +263,7 @@ int CORD_vsprintf(CORD * out, CORD format, va_list args) goto done; case 'c': if (width == NONE && prec == NONE) { - register char c; + char c; c = (char)va_arg(args, int); CORD_ec_append(result, c); @@ -273,7 +273,7 @@ int CORD_vsprintf(CORD * out, CORD format, va_list args) case 's': if (width == NONE && prec == NONE) { char * str = va_arg(args, char *); - register char c; + char c; while ((c = *str++)) { CORD_ec_append(result, c); @@ -286,7 +286,7 @@ int CORD_vsprintf(CORD * out, CORD format, va_list args) } /* Use standard sprintf to perform conversion */ { - register char * buf; + char * buf; va_list vsprintf_args; int max_size = 0; int res = 0; @@ -360,7 +360,7 @@ int CORD_vsprintf(CORD * out, CORD format, va_list args) return(-1); } if (buf != result[0].ec_bufptr) { - register char c; + char c; while ((c = *buf++)) { CORD_ec_append(result, c); diff --git a/cord/cordxtra.c b/cord/cordxtra.c index 97060a8..5ee4df7 100644 --- a/cord/cordxtra.c +++ b/cord/cordxtra.c @@ -71,7 +71,7 @@ typedef void (* oom_fn)(void); CORD CORD_cat_char(CORD x, char c) { - register char * string; + char * string; if (c == '\0') return(CORD_cat(x, CORD_nul(1))); string = (char *)GC_MALLOC_ATOMIC(2); @@ -83,13 +83,13 @@ CORD CORD_cat_char(CORD x, char c) CORD CORD_catn(int nargs, ...) { - register CORD result = CORD_EMPTY; + CORD result = CORD_EMPTY; va_list args; - register int i; + int i; va_start(args, nargs); for (i = 0; i < nargs; i++) { - register CORD next = va_arg(args, CORD); + CORD next = va_arg(args, CORD); result = CORD_cat(result, next); } va_end(args); @@ -104,8 +104,8 @@ typedef struct { int CORD_fill_proc(char c, void * client_data) { - register CORD_fill_data * d = (CORD_fill_data *)client_data; - register size_t count = d -> count; + CORD_fill_data * d = (CORD_fill_data *)client_data; + size_t count = d -> count; (d -> buf)[count] = c; d -> count = ++count; @@ -118,11 +118,11 @@ int CORD_fill_proc(char c, void * client_data) int CORD_batched_fill_proc(const char * s, void * client_data) { - register CORD_fill_data * d = (CORD_fill_data *)client_data; - register size_t count = d -> count; - register size_t max = d -> len; - register char * buf = d -> buf; - register const char * t = s; + CORD_fill_data * d = (CORD_fill_data *)client_data; + size_t count = d -> count; + size_t max = d -> len; + char * buf = d -> buf; + const char * t = s; while((buf[count] = *t++) != '\0') { count++; @@ -175,14 +175,14 @@ int CORD_cmp(CORD x, CORD y) avail = CORD_pos_chars_left(xpos); if (avail == 0 || (yavail = CORD_pos_chars_left(ypos)) == 0) { - register char xcurrent = CORD_pos_fetch(xpos); - register char ycurrent = CORD_pos_fetch(ypos); + char xcurrent = CORD_pos_fetch(xpos); + char ycurrent = CORD_pos_fetch(ypos); if (xcurrent != ycurrent) return(xcurrent - ycurrent); CORD_next(xpos); CORD_next(ypos); } else { /* process as many characters as we can */ - register int result; + int result; if (avail > yavail) avail = yavail; result = strncmp(CORD_pos_cur_char_addr(xpos), @@ -198,7 +198,7 @@ int CORD_ncmp(CORD x, size_t x_start, CORD y, size_t y_start, size_t len) { CORD_pos xpos; CORD_pos ypos; - register size_t count; + size_t count; CORD_set_pos(xpos, x, x_start); CORD_set_pos(ypos, y, y_start); @@ -217,15 +217,16 @@ int CORD_ncmp(CORD x, size_t x_start, CORD y, size_t y_start, size_t len) } if ((avail = CORD_pos_chars_left(xpos)) <= 0 || (yavail = CORD_pos_chars_left(ypos)) <= 0) { - register char xcurrent = CORD_pos_fetch(xpos); - register char ycurrent = CORD_pos_fetch(ypos); + char xcurrent = CORD_pos_fetch(xpos); + char ycurrent = CORD_pos_fetch(ypos); + if (xcurrent != ycurrent) return(xcurrent - ycurrent); CORD_next(xpos); CORD_next(ypos); count++; } else { /* process as many characters as we can */ - register int result; + int result; if (avail > yavail) avail = yavail; count += avail; @@ -243,7 +244,7 @@ int CORD_ncmp(CORD x, size_t x_start, CORD y, size_t y_start, size_t len) char * CORD_to_char_star(CORD x) { - register size_t len = CORD_len(x); + size_t len = CORD_len(x); char * result = (char *)GC_MALLOC_ATOMIC(len + 1); if (result == 0) OUT_OF_MEMORY; @@ -284,14 +285,14 @@ char CORD_fetch(CORD x, size_t i) int CORD_put_proc(char c, void * client_data) { - register FILE * f = (FILE *)client_data; + FILE * f = (FILE *)client_data; return(putc(c, f) == EOF); } int CORD_batched_put_proc(const char * s, void * client_data) { - register FILE * f = (FILE *)client_data; + FILE * f = (FILE *)client_data; return(fputs(s, f) == EOF); } @@ -313,7 +314,7 @@ typedef struct { int CORD_chr_proc(char c, void * client_data) { - register chr_data * d = (chr_data *)client_data; + chr_data * d = (chr_data *)client_data; if (c == d -> target) return(1); (d -> pos) ++; @@ -322,7 +323,7 @@ int CORD_chr_proc(char c, void * client_data) int CORD_rchr_proc(char c, void * client_data) { - register chr_data * d = (chr_data *)client_data; + chr_data * d = (chr_data *)client_data; if (c == d -> target) return(1); (d -> pos) --; @@ -331,7 +332,7 @@ int CORD_rchr_proc(char c, void * client_data) int CORD_batched_chr_proc(const char *s, void * client_data) { - register chr_data * d = (chr_data *)client_data; + chr_data * d = (chr_data *)client_data; const char * occ = strchr(s, d -> target); if (NULL == occ) { @@ -380,15 +381,15 @@ size_t CORD_str(CORD x, size_t start, CORD s) CORD_pos xpos; size_t xlen = CORD_len(x); size_t slen; - register size_t start_len; + size_t start_len; const char * s_start; unsigned long s_buf = 0; /* The first few characters of s */ unsigned long x_buf = 0; /* Start of candidate substring. */ /* Initialized only to make compilers */ /* happy. */ unsigned long mask = 0; - register size_t i; - register size_t match_pos; + size_t i; + size_t match_pos; if (s == CORD_EMPTY) return(start); if (CORD_IS_STRING(s)) { @@ -430,7 +431,7 @@ size_t CORD_str(CORD x, size_t start, CORD s) void CORD_ec_flush_buf(CORD_ec x) { - register size_t len = x[0].ec_bufptr - x[0].ec_buf; + size_t len = x[0].ec_bufptr - x[0].ec_buf; char * s; if (len == 0) return; @@ -470,7 +471,7 @@ CORD CORD_from_file_eager(FILE * f) /* Append the right number of NULs */ /* Note that any string of NULs is represented in 4 words, */ /* independent of its length. */ - register size_t count = 1; + size_t count = 1; CORD_ec_flush_buf(ecord); while ((c = getc(f)) == 0) count++; @@ -528,8 +529,8 @@ typedef struct { /* Executed with allocation lock. */ static char refill_cache(refill_data * client_data) { - register lf_state * state = client_data -> state; - register size_t file_pos = client_data -> file_pos; + lf_state * state = client_data -> state; + size_t file_pos = client_data -> file_pos; FILE *f = state -> lf_file; size_t line_start = LINE_START(file_pos); size_t line_no = DIV_LINE_SZ(MOD_CACHE_SZ(file_pos)); @@ -552,10 +553,10 @@ static char refill_cache(refill_data * client_data) char CORD_lf_func(size_t i, void * client_data) { - register lf_state * state = (lf_state *)client_data; - register cache_line * volatile * cl_addr = - &(state -> lf_cache[DIV_LINE_SZ(MOD_CACHE_SZ(i))]); - register cache_line * cl = (cache_line *)ATOMIC_READ(cl_addr); + lf_state * state = (lf_state *)client_data; + cache_line * volatile * cl_addr = + &(state -> lf_cache[DIV_LINE_SZ(MOD_CACHE_SZ(i))]); + cache_line * cl = (cache_line *)ATOMIC_READ(cl_addr); if (cl == 0 || cl -> tag != DIV_LINE_SZ(i)) { /* Cache miss */ @@ -580,8 +581,8 @@ void CORD_lf_close_proc(void * obj, void * client_data CORD_ATTR_UNUSED) CORD CORD_from_file_lazy_inner(FILE * f, size_t len) { - register lf_state * state = GC_NEW(lf_state); - register int i; + lf_state * state = GC_NEW(lf_state); + int i; if (state == 0) OUT_OF_MEMORY; if (len != 0) { @@ -608,7 +609,7 @@ CORD CORD_from_file_lazy_inner(FILE * f, size_t len) CORD CORD_from_file_lazy(FILE * f) { - register long len; + long len; if (fseek(f, 0l, SEEK_END) != 0 || (len = ftell(f)) < 0 @@ -622,7 +623,7 @@ CORD CORD_from_file_lazy(FILE * f) CORD CORD_from_file(FILE * f) { - register long len; + long len; if (fseek(f, 0l, SEEK_END) != 0 || (len = ftell(f)) < 0 diff --git a/cord/tests/cordtest.c b/cord/tests/cordtest.c index e05e6a5..8de6980 100644 --- a/cord/tests/cordtest.c +++ b/cord/tests/cordtest.c @@ -65,7 +65,7 @@ char id_cord_fn(size_t i, void * client_data) void test_basics(void) { CORD x = CORD_from_char_star("ab"); - register int i; + int i; CORD y; CORD_pos p; @@ -148,7 +148,7 @@ void test_extras(void) { # define FNAME1 "cordtst1.tmp" /* short name (8+3) for portability */ # define FNAME2 "cordtst2.tmp" - register int i; + int i; CORD y = "abcdefghijklmnopqrstuvwxyz0123456789"; CORD x = "{}"; CORD u, w, z; diff --git a/cord/tests/de.c b/cord/tests/de.c index 01cc5c5..321296c 100644 --- a/cord/tests/de.c +++ b/cord/tests/de.c @@ -271,7 +271,7 @@ CORD retrieve_line(CORD s, size_t pos, unsigned column) CORD retrieve_screen_line(int i) { - register size_t pos; + size_t pos; invalidate_map(dis_line + LINES); /* Prune search */ pos = line_pos(dis_line + i, 0); @@ -283,12 +283,12 @@ CORD retrieve_line(CORD s, size_t pos, unsigned column) /* Display the visible section of the current file */ void redisplay(void) { - register int i; + int i; invalidate_map(dis_line + LINES); /* Prune search */ for (i = 0; i < LINES; i++) { if (need_redisplay == ALL || need_redisplay == i) { - register size_t pos = line_pos(dis_line + i, 0); + size_t pos = line_pos(dis_line + i, 0); if (pos == CORD_NOT_FOUND) break; replace_line(i, retrieve_line(current, pos, dis_col)); diff --git a/cord/tests/de_win.c b/cord/tests/de_win.c index d99942e..24f0a6e 100644 --- a/cord/tests/de_win.c +++ b/cord/tests/de_win.c @@ -121,7 +121,7 @@ int APIENTRY WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, char * plain_chars(char * text, size_t len) { char * result = (char *)GC_MALLOC_ATOMIC(len + 1); - register size_t i; + size_t i; if (NULL == result) return NULL; for (i = 0; i < len; i++) { @@ -140,7 +140,7 @@ char * plain_chars(char * text, size_t len) char * control_chars(char * text, size_t len) { char * result = (char *)GC_MALLOC_ATOMIC(len + 1); - register size_t i; + size_t i; if (NULL == result) return NULL; for (i = 0; i < len; i++) { @@ -208,7 +208,7 @@ LRESULT CALLBACK WndProc (HWND hwnd, UINT message, RECT this_line; RECT dummy; TEXTMETRIC tm; - register int i; + int i; int id; switch (message)