ruby-changes:57298
From: Nobuyoshi <ko1@a...>
Date: Tue, 27 Aug 2019 14:27:01 +0900 (JST)
Subject: [ruby-changes:57298] Nobuyoshi Nakada: 2789bdddc7 (master): Use array indexing with considering clang's feeling
https://git.ruby-lang.org/ruby.git/commit/?id=2789bdddc7 From 2789bdddc7602fbc2089242d12e5cc4deed181c4 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada <nobu@r...> Date: Tue, 27 Aug 2019 14:20:07 +0900 Subject: Use array indexing with considering clang's feeling ``` In file included from sprintf.c:1256: ./vsnprintf.c:833:8: warning: adding 'int' to a string does not append to the string [-Wstring-plus-int] IS_PRI_EXTRA_MARK(fmt)) { ^~~~~~~~~~~~~~~~~~~~~~ ./vsnprintf.c:826:34: note: expanded from macro 'IS_PRI_EXTRA_MARK' strncmp((s)+1, PRI_EXTRA_MARK+1, \ ~~~~~~~~~~~~~~^~ ./vsnprintf.c:833:8: note: use array indexing to silence this warning ./vsnprintf.c:826:34: note: expanded from macro 'IS_PRI_EXTRA_MARK' strncmp((s)+1, PRI_EXTRA_MARK+1, \ ^ 1 warning generated. ``` diff --git a/vsnprintf.c b/vsnprintf.c index bb77e3d..889c409 100644 --- a/vsnprintf.c +++ b/vsnprintf.c @@ -823,7 +823,7 @@ reswitch: switch (ch) { https://github.com/ruby/ruby/blob/trunk/vsnprintf.c#L823 (PRI_EXTRA_MARK_LEN < 1 || \ (*(s) == PRI_EXTRA_MARK[0] && \ (PRI_EXTRA_MARK_LEN == 1 || \ - strncmp((s)+1, PRI_EXTRA_MARK+1, \ + strncmp((s)+1, &PRI_EXTRA_MARK[1], \ PRI_EXTRA_MARK_LEN-1) == 0))) #else # define PRI_EXTRA_MARK_LEN 0 -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/