Re: [PATCH 10/12] setterm: use string constant rather than #define

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

 



On Sun, May 11, 2014 at 08:26:47PM +0100, Sami Kerola wrote:
> -/* Control sequences. */
> -#define ESC "\033"
> -
>  /* Static variables. */
>  
>  /* Option flags.  Set if the option is to be invoked. */
> @@ -796,6 +793,8 @@ static char *ti_entry(const char *name) {
>  
>  static void
>  perform_sequence(int vcterm) {
> +	static const char *ESC = "\033";

Sorry, but this is really premature optimization, \033 is just one char.

>  	/* vcterm: Set if terminal is a virtual console. */
>  
>  	int result;
> @@ -822,25 +821,25 @@ perform_sequence(int vcterm) {
>  	/* -linewrap [on|off]. Vc only (vt102) */
>  	if (opt_linewrap && vcterm) {
>  		if (opt_li_on)
> -			printf("\033[?7h");
> +			printf("%s[?7h", ESC);

  fputs("\033[?7h", stdout);

is the right, simple and fast way.

Fixed and merged.

    Karel

-- 
 Karel Zak  <kzak@xxxxxxxxxx>
 http://karelzak.blogspot.com
--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux