[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Nano-devel] Should we rename and untypedef nano's structs?
From: |
Devin Hussey |
Subject: |
Re: [Nano-devel] Should we rename and untypedef nano's structs? |
Date: |
Sun, 19 Aug 2018 16:38:26 -0400 |
> ---------- Forwarded message ----------
> From: "Marco Diego Aurélio Mesquita" <address@hidden>
> To: address@hidden
> Cc:
> Bcc:
> Date: Sun, 19 Aug 2018 12:41:17 -0300
> Subject: Re: [Nano-devel] Should we rename and untypedef nano's structs?
> On Sun, Aug 19, 2018 at 10:30:06AM -0400, Devin Hussey wrote:
>> So my ideas:
>>
>> filestruct -> struct node, struct line
>> openfilestruct -> struct file, struct open_file, struct buffer
>> sc -> struct kbd_shortcut, struct shortcut
>> subnfunc -> struct menu_shortcut
>> colortype -> struct syntax_rule, struct syntax_def, struct syntax_color
>> regexlisttype -> struct regex_list
>> syntaxtype -> struct syntax_family, struct syntax_lang[uage], struct
>> syntax_class
>> partition -> struct visible_nodes, something, idk
>> poshiststruct -> struct position_hist[ory]
>> undo -> struct undo, struct undo_step
>> undo_group -> struct undo_group
>>
>> We could keep the typedef structs in, but I find it doesn't help in snake
>> case.
>>
>> Additionally, fileage should be renamed, it also doesn't make sense.
>>
>> Do you have any thoughts about this?
>>
>
> I agree that these struct have bad names and should be renamed. Don't know
> haw to name them though. Also, I don't think they should be untypedef'ed.
Benno, what are your thoughts?
For the reference, here is a before/after comparison (also removed
malloc casts because we need a C compiler for gnulib anyways)
filestruct *make_new_node(filestruct *prevnode)
{
filestruct *newnode = (filestruct *)nmalloc(sizeof(filestruct));
newnode->data = NULL;
newnode->prev = prevnode;
newnode->next = NULL;
newnode->lineno = (prevnode != NULL) ? prevnode->lineno + 1 : 1;
#ifdef ENABLE_COLOR
newnode->multidata = NULL;
#endif
return newnode;
}
struct node *make_new_node(struct node *prevnode)
{
struct node *newnode = nmalloc(sizeof(struct node));
newnode->data = NULL;
newnode->prev = prevnode;
newnode->next = NULL;
newnode->lineno = (prevnode != NULL) ? prevnode->lineno + 1 : 1;
#ifdef ENABLE_COLOR
newnode->multidata = NULL;
#endif
return newnode;
}