[hackers] [scc] [cc1] Do not include the \0 in initialized strings || Roberto E. Vargas Caballero

From: <git_AT_suckless.org>
Date: Tue, 26 Jan 2016 19:39:20 +0100 (CET)

commit 7dd517166fa92d4fd8d57599b50d8b9394eea693
Author: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
AuthorDate: Tue Jan 26 15:26:31 2016 +0100
Commit: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
CommitDate: Tue Jan 26 15:26:31 2016 +0100

    [cc1] Do not include the \0 in initialized strings
    
    The target string is initialized to \0, so we don't have to
    include explicitily the \0, because in this cause it was
    incrementing the size of the target in 1.

diff --git a/cc1/init.c b/cc1/init.c
index 1618570..6b38a7a 100644
--- a/cc1/init.c
+++ b/cc1/init.c
_AT_@ -120,7 +120,7 @@ initialize(Type *tp)
                         errorp("array of inappropriate type initialized from string constant");
                         goto return_zero;
                 }
- len = sym->type->n.elem;
+ len = sym->type->n.elem-1;
                 if (!tp->defined) {
                         tp->defined = 1;
                         tp->n.elem = len+1;
Received on Tue Jan 26 2016 - 19:39:20 CET

This archive was generated by hypermail 2.3.0 : Tue Jan 26 2016 - 19:48:16 CET