nano-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Nano-devel] Add function to convert leading whitespace to tabs


From: Mike Frysinger
Subject: Re: [Nano-devel] Add function to convert leading whitespace to tabs
Date: Sat, 18 Oct 2014 14:30:05 -0400
User-agent: KMail/4.14.1 (Linux/3.14.2; KDE/4.14.1; x86_64; ; )

On Sat 18 Oct 2014 09:30:08 Erik Lundin wrote:
> +    /* If the mark is on, use all lines covered by the mark. */
> +    if (openfile->mark_set)
> +        mark_order((const filestruct **)&top, &top_x,
> +          (const filestruct **)&bot, &bot_x, NULL);
> +        /* Otherwise, use the current line. */
> +    else {

this is dangerous -- there really should be braces in the first case

> +        /* Calculate how much space the whitespace is using */

you mix style here ... sometimes you have a period at the end and sometimes 
you don't.

> +        for(i = 0; i < line_len; i++) {
> +            if(f->data[i] == ' ') {
> +                spaces++;
> +            } else if(f->data[i] == '\t') {

there should be a space after the for & if.  this comes up a few times in your 
patch.

> +    size_t top_x, bot_x, line_len;
> +    int i, spaces, tabs, tabs_needed, ws_len, new_len;

you mix these types below and compare/assign int's to size_t's.  you probably 
need to harmonize that.

> +        tabs_needed = ((spaces + tabsize - 1)/tabsize) + tabs;

needs spaces around the /
-mike

Attachment: signature.asc
Description: This is a digitally signed message part.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]