1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-12-04 14:46:47 -05:00

new -> new_ for C++ compatibility

This commit is contained in:
Witold Filipczyk 2016-04-20 18:42:22 +02:00
parent f4981bb553
commit 67673f5fe5
11 changed files with 78 additions and 78 deletions

View File

@ -410,12 +410,12 @@ add_option_to_tree(void *data, unsigned char *name)
{ {
struct add_option_to_tree_ctx *ctx = data; struct add_option_to_tree_ctx *ctx = data;
struct option *old = get_opt_rec_real(ctx->option, name); struct option *old = get_opt_rec_real(ctx->option, name);
struct option *new; struct option *new_;
if (old && (old->flags & OPT_DELETED)) delete_option(old); if (old && (old->flags & OPT_DELETED)) delete_option(old);
/* get_opt_rec() will create the option. */ /* get_opt_rec() will create the option. */
new = get_opt_rec(ctx->option, name); new_ = get_opt_rec(ctx->option, name);
if (new) listbox_sel(ctx->widget_data, new->box_item); if (new_) listbox_sel(ctx->widget_data, new_->box_item);
/* TODO: If the return value is NULL, we should pop up a msgbox. */ /* TODO: If the return value is NULL, we should pop up a msgbox. */
} }

View File

@ -347,10 +347,10 @@ str_wr(struct option *o, struct string *s)
static void static void
str_dup(struct option *opt, struct option *template_, int flags) str_dup(struct option *opt, struct option *template_, int flags)
{ {
unsigned char *new = mem_alloc(MAX_STR_LEN); unsigned char *new_ = mem_alloc(MAX_STR_LEN);
if (new) safe_strncpy(new, template_->value.string, MAX_STR_LEN); if (new_) safe_strncpy(new_, template_->value.string, MAX_STR_LEN);
opt->value.string = new; opt->value.string = new_;
} }
@ -443,12 +443,12 @@ color_wr(struct option *opt, struct string *str)
static void static void
tree_dup(struct option *opt, struct option *template_, int flags) tree_dup(struct option *opt, struct option *template_, int flags)
{ {
LIST_OF(struct option) *new = init_options_tree(); LIST_OF(struct option) *new_ = init_options_tree();
LIST_OF(struct option) *tree = template_->value.tree; LIST_OF(struct option) *tree = template_->value.tree;
struct option *option; struct option *option;
if (!new) return; if (!new_) return;
opt->value.tree = new; opt->value.tree = new_;
if (flags & CO_SHALLOW) return; if (flags & CO_SHALLOW) return;
@ -457,7 +457,7 @@ tree_dup(struct option *opt, struct option *template_, int flags)
if (!new_opt) continue; if (!new_opt) continue;
object_nolock(new_opt, "option"); object_nolock(new_opt, "option");
add_to_list_end(*new, new_opt); add_to_list_end(*new_, new_opt);
object_lock(new_opt); object_lock(new_opt);
new_opt->root = opt; new_opt->root = opt;

View File

@ -398,7 +398,7 @@ new_cell(struct table *table, int dest_col, int dest_row)
return CELL(table, dest_col, dest_row); return CELL(table, dest_col, dest_row);
while (1) { while (1) {
struct table new; struct table new_;
int limit; int limit;
if (dest_col < table->real_cols && dest_row < table->real_rows) { if (dest_col < table->real_cols && dest_row < table->real_rows) {
@ -406,31 +406,31 @@ new_cell(struct table *table, int dest_col, int dest_row)
return CELL(table, dest_col, dest_row); return CELL(table, dest_col, dest_row);
} }
new.real_cols = smart_raise(dest_col + 1, table->real_cols, new_.real_cols = smart_raise(dest_col + 1, table->real_cols,
sizeof(*new.cells), sizeof(*new_.cells),
/* assume square distribution of /* assume square distribution of
* cols/rows */ * cols/rows */
SMART_RAISE_LIMIT / 2); SMART_RAISE_LIMIT / 2);
if (!new.real_cols) return NULL; if (!new_.real_cols) return NULL;
limit = SMART_RAISE_LIMIT limit = SMART_RAISE_LIMIT
- sizeof(*new.cells) * new.real_cols; - sizeof(*new_.cells) * new_.real_cols;
limit = MAX(limit, SMART_RAISE_LIMIT/2); limit = MAX(limit, SMART_RAISE_LIMIT/2);
new.real_rows = smart_raise(dest_row + 1, table->real_rows, new_.real_rows = smart_raise(dest_row + 1, table->real_rows,
sizeof(*new.cells), limit); sizeof(*new_.cells), limit);
if (!new.real_rows) return NULL; if (!new_.real_rows) return NULL;
new.cells = mem_calloc(new.real_cols * new.real_rows, new_.cells = mem_calloc(new_.real_cols * new_.real_rows,
sizeof(*new.cells)); sizeof(*new_.cells));
if (!new.cells) return NULL; if (!new_.cells) return NULL;
copy_table(table, &new); copy_table(table, &new_);
mem_free(table->cells); mem_free(table->cells);
table->cells = new.cells; table->cells = new_.cells;
table->real_cols = new.real_cols; table->real_cols = new_.real_cols;
table->real_rows = new.real_rows; table->real_rows = new_.real_rows;
} }
} }

View File

@ -1445,7 +1445,7 @@ out:
} }
while (*translit) { while (*translit) {
unsigned char *new; unsigned char *new_;
buffer[bufferpos++] = *(translit++); buffer[bufferpos++] = *(translit++);
flush: flush:
@ -1456,12 +1456,12 @@ flush:
callback(callback_data, buffer, bufferpos); callback(callback_data, buffer, bufferpos);
bufferpos = 0; bufferpos = 0;
} else { } else {
new = mem_realloc(buffer, bufferpos + ALLOC_GR); new_ = mem_realloc(buffer, bufferpos + ALLOC_GR);
if (!new) { if (!new_) {
mem_free(buffer); mem_free(buffer);
return NULL; return NULL;
} }
buffer = new; buffer = new_;
} }
} }
#undef PUTC #undef PUTC

View File

@ -99,25 +99,25 @@ void
menu_add_ext(struct terminal *term, void *fcp, void *xxx2) menu_add_ext(struct terminal *term, void *fcp, void *xxx2)
{ {
/* [gettext_accelerator_context(menu_add_ext)] */ /* [gettext_accelerator_context(menu_add_ext)] */
struct extension *new; struct extension *new_;
struct dialog *dlg; struct dialog *dlg;
#define MIME_WIDGETS_COUNT 4 #define MIME_WIDGETS_COUNT 4
dlg = calloc_dialog(MIME_WIDGETS_COUNT, sizeof(*new)); dlg = calloc_dialog(MIME_WIDGETS_COUNT, sizeof(*new_));
if (!dlg) { if (!dlg) {
mem_free_if(fcp); mem_free_if(fcp);
return; return;
} }
new = (struct extension *) get_dialog_offset(dlg, MIME_WIDGETS_COUNT); new_ = (struct extension *) get_dialog_offset(dlg, MIME_WIDGETS_COUNT);
if (fcp) { if (fcp) {
struct option *opt = get_real_opt("mime.extension", fcp); struct option *opt = get_real_opt("mime.extension", fcp);
if (opt) { if (opt) {
safe_strncpy(new->ext, fcp, MAX_STR_LEN); safe_strncpy(new_->ext, fcp, MAX_STR_LEN);
safe_strncpy(new->ct, opt->value.string, MAX_STR_LEN); safe_strncpy(new_->ct, opt->value.string, MAX_STR_LEN);
safe_strncpy(new->ext_orig, fcp, MAX_STR_LEN); safe_strncpy(new_->ext_orig, fcp, MAX_STR_LEN);
} }
mem_free(fcp); mem_free(fcp);
@ -126,10 +126,10 @@ menu_add_ext(struct terminal *term, void *fcp, void *xxx2)
dlg->title = _("Extension", term); dlg->title = _("Extension", term);
dlg->layouter = generic_dialog_layouter; dlg->layouter = generic_dialog_layouter;
add_dlg_field(dlg, _("Extension(s)", term), 0, 0, check_nonempty, MAX_STR_LEN, new->ext, NULL); add_dlg_field(dlg, _("Extension(s)", term), 0, 0, check_nonempty, MAX_STR_LEN, new_->ext, NULL);
add_dlg_field(dlg, _("Content-Type", term), 0, 0, check_nonempty, MAX_STR_LEN, new->ct, NULL); add_dlg_field(dlg, _("Content-Type", term), 0, 0, check_nonempty, MAX_STR_LEN, new_->ct, NULL);
add_dlg_ok_button(dlg, _("~OK", term), B_ENTER, add_mime_extension, new); add_dlg_ok_button(dlg, _("~OK", term), B_ENTER, add_mime_extension, new_);
add_dlg_button(dlg, _("~Cancel", term), B_ESC, cancel_dialog, NULL); add_dlg_button(dlg, _("~Cancel", term), B_ESC, cancel_dialog, NULL);
add_dlg_end(dlg, MIME_WIDGETS_COUNT); add_dlg_end(dlg, MIME_WIDGETS_COUNT);

View File

@ -1075,7 +1075,7 @@ cancel_download(struct download *download, int interrupt)
} }
void void
move_download(struct download *old, struct download *new, move_download(struct download *old, struct download *new_,
enum connection_priority newpri) enum connection_priority newpri)
{ {
struct connection *conn; struct connection *conn;
@ -1088,29 +1088,29 @@ move_download(struct download *old, struct download *new,
conn = old->conn; conn = old->conn;
new->conn = conn; new_->conn = conn;
new->cached = old->cached; new_->cached = old->cached;
new->prev_error = old->prev_error; new_->prev_error = old->prev_error;
new->progress = old->progress; new_->progress = old->progress;
new->state = old->state; new_->state = old->state;
new->pri = newpri; new_->pri = newpri;
if (is_in_result_state(old->state)) { if (is_in_result_state(old->state)) {
/* Ensure that new->conn is always "valid", that is NULL if the /* Ensure that new_->conn is always "valid", that is NULL if the
* connection has been detached and non-NULL otherwise. */ * connection has been detached and non-NULL otherwise. */
if (new->callback) { if (new_->callback) {
new->conn = NULL; new_->conn = NULL;
new->progress = NULL; new_->progress = NULL;
new->callback(new, new->data); new_->callback(new_, new_->data);
} }
return; return;
} }
assertm(old->conn != NULL, "last state is %d", old->state); assertm(old->conn != NULL, "last state is %d", old->state);
conn->pri[new->pri]++; conn->pri[new_->pri]++;
add_to_list(conn->downloads, new); add_to_list(conn->downloads, new_);
/* In principle, we need to sort_queue() only if conn->pri[new->pri] /* In principle, we need to sort_queue() only if conn->pri[new_->pri]
* just changed from 0 to 1. But the risk of bugs is smaller if we * just changed from 0 to 1. But the risk of bugs is smaller if we
* sort every time. */ * sort every time. */
sort_queue(); sort_queue();

View File

@ -99,7 +99,7 @@ void abort_connection(struct connection *, struct connection_state);
void retry_connection(struct connection *, struct connection_state); void retry_connection(struct connection *, struct connection_state);
void cancel_download(struct download *download, int interrupt); void cancel_download(struct download *download, int interrupt);
void move_download(struct download *old, struct download *new, void move_download(struct download *old, struct download *new_,
enum connection_priority newpri); enum connection_priority newpri);
void detach_connection(struct download *, off_t); void detach_connection(struct download *, off_t);

View File

@ -97,13 +97,13 @@ NONSTATIC_INLINE char *
elinks_strdup(const char *str) elinks_strdup(const char *str)
{ {
int str_len = strlen(str); int str_len = strlen(str);
char *new = malloc(str_len + 1); char *new_ = malloc(str_len + 1);
if (new) { if (new_) {
if (str_len) memcpy(new, str, str_len); if (str_len) memcpy(new_, str, str_len);
new[str_len] = '\0'; new_[str_len] = '\0';
} }
return new; return new_;
} }
#endif #endif

View File

@ -1456,12 +1456,12 @@ tp_display(struct type_query *type_query)
if (/* !type_query->frame */ 1) { if (/* !type_query->frame */ 1) {
struct download *old = &type_query->download; struct download *old = &type_query->download;
struct download *new = &cur_loc(ses)->download; struct download *new_ = &cur_loc(ses)->download;
new->callback = (download_callback_T *) doc_loading_callback; new_->callback = (download_callback_T *) doc_loading_callback;
new->data = ses; new_->data = ses;
move_download(old, new, PRI_MAIN); move_download(old, new_, PRI_MAIN);
} }
display_timer(ses); display_timer(ses);

View File

@ -386,19 +386,19 @@ static inline void
compress_node(struct ff_node *leafset, struct fastfind_info *info, compress_node(struct ff_node *leafset, struct fastfind_info *info,
int i, int pos) int i, int pos)
{ {
struct ff_node_c *new = mem_alloc(sizeof(*new)); struct ff_node_c *new_ = mem_alloc(sizeof(*new_));
if (!new) return; if (!new_) return;
new->c = 1; new_->c = 1;
new->e = leafset[pos].e; new_->e = leafset[pos].e;
new->p = leafset[pos].p; new_->p = leafset[pos].p;
new->l = leafset[pos].l; new_->l = leafset[pos].l;
new->ch = pos; new_->ch = pos;
mem_free_set(&info->leafsets[i], (struct ff_node *) new); mem_free_set(&info->leafsets[i], (struct ff_node *) new_);
FF_DBG_cnode(info); FF_DBG_cnode(info);
FF_DBG_mem(info, sizeof(*new)); FF_DBG_mem(info, sizeof(*new_));
FF_DBG_mem(info, sizeof(*leafset) * -info->uniq_chars_count); FF_DBG_mem(info, sizeof(*leafset) * -info->uniq_chars_count);
} }

View File

@ -112,9 +112,9 @@ mem_align_alloc__(
#ifdef DEBUG_MEMLEAK #ifdef DEBUG_MEMLEAK
const unsigned char *file, int line, const unsigned char *file, int line,
#endif #endif
void **ptr, size_t old, size_t new, size_t objsize, size_t mask) void **ptr, size_t old, size_t new_, size_t objsize, size_t mask)
{ {
size_t newsize = ALIGN_MEMORY_SIZE(new, mask); size_t newsize = ALIGN_MEMORY_SIZE(new_, mask);
size_t oldsize = ALIGN_MEMORY_SIZE(old, mask); size_t oldsize = ALIGN_MEMORY_SIZE(old, mask);
if (newsize > oldsize) { if (newsize > oldsize) {
@ -138,11 +138,11 @@ mem_align_alloc__(
} }
#ifdef DEBUG_MEMLEAK #ifdef DEBUG_MEMLEAK
#define mem_align_alloc(ptr, old, new, mask) \ #define mem_align_alloc(ptr, old, new_, mask) \
mem_align_alloc__(__FILE__, __LINE__, (void **) ptr, old, new, sizeof(**ptr), mask) mem_align_alloc__(__FILE__, __LINE__, (void **) ptr, old, new_, sizeof(**ptr), mask)
#else #else
#define mem_align_alloc(ptr, old, new, mask) \ #define mem_align_alloc(ptr, old, new_, mask) \
mem_align_alloc__((void **) ptr, old, new, sizeof(**ptr), mask) mem_align_alloc__((void **) ptr, old, new_, sizeof(**ptr), mask)
#endif #endif
/** @} */ /** @} */