raster pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=26ea0eaac2a55da5417795babc29d2927005e9fc

commit 26ea0eaac2a55da5417795babc29d2927005e9fc
Author: Carsten Haitzler (Rasterman) <ras...@rasterman.com>
Date:   Wed May 26 13:50:07 2021 +0100

    embryo - embryo_cc - one more warning bites the dust
---
 src/bin/embryo/embryo_cc_sc1.c | 25 ++++++++++++-------------
 1 file changed, 12 insertions(+), 13 deletions(-)

diff --git a/src/bin/embryo/embryo_cc_sc1.c b/src/bin/embryo/embryo_cc_sc1.c
index de9417722e..9fbeb4dcf0 100644
--- a/src/bin/embryo/embryo_cc_sc1.c
+++ b/src/bin/embryo/embryo_cc_sc1.c
@@ -3032,22 +3032,21 @@ insert_constval(constvalue * prev, constvalue * next, 
char *name,
                cell val, short idx)
 {
    constvalue         *cur;
-//   char               *s, *d;
+   char *s, *d;
 
    if (!(cur = calloc(1, sizeof(constvalue))))
       error(103);              /* insufficient memory (fatal error) */
-   strncpy(cur->name, name, sizeof(cur->name) - 1);
-// I'm forced to do the below as new gcc warnings I can't seem to shut up
-// complain so implement in full to get some silence.
-//   for (d = cur->name, s = name; ; )
-//     {
-//        *d++ = *s;
-//        if ((size_t)(s - name) < (size_t)(sizeof(cur->name) - 1))
-//          {
-//             if (*s) s++;
-//          }
-//        else break;
-//     }
+
+// new gcc's want to warn about this.. it doesn't make sense... but if i
+// implement strncpy inline to get some peace and quiet
+//   strncpy(cur->name, name, sizeof(cur->name) - 1);
+   for (s = name, d = cur->name; ; )
+     {
+        *d = *s;
+        if (*s) s++;
+        if ((d - cur->name) == (sizeof(cur->name) - 1)) break;
+        d++;
+     }
    cur->name[sizeof(cur->name) - 1] = 0;
    cur->value = val;
    cur->index = idx;

-- 


Reply via email to