1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

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.
```
This commit is contained in:
Nobuyoshi Nakada 2019-08-27 14:20:07 +09:00
parent d53b669948
commit 2789bdddc7
No known key found for this signature in database
GPG key ID: 4BC7D6DF58D8DF60

View file

@ -823,7 +823,7 @@ reswitch: switch (ch) {
(PRI_EXTRA_MARK_LEN < 1 || \ (PRI_EXTRA_MARK_LEN < 1 || \
(*(s) == PRI_EXTRA_MARK[0] && \ (*(s) == PRI_EXTRA_MARK[0] && \
(PRI_EXTRA_MARK_LEN == 1 || \ (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))) PRI_EXTRA_MARK_LEN-1) == 0)))
#else #else
# define PRI_EXTRA_MARK_LEN 0 # define PRI_EXTRA_MARK_LEN 0