Re: [PATCH] Implement utf8 unit tests as a kunit test suite.

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

 



Hi Gabriel,

Thanks for the comments. I agree with all the style and typo fixes (sorry about
that stray "ext4" mention, I copied the help message from the ext4 kunit config
option and I didn't notice that).

On mié 15-04-2020 14:40:23, Gabriel Krisman Bertazi wrote:
> Instead of this random len and the snprintf to generate the string at
> runtime, why not just:
> 
> #define LATEST_VERSION_STR "12.1.0"
> 
> And use it directly, since it is constant.

I don't think it's a good idea to have the version specifier hardcoded twice in
the same file, one in string form (for utf8_load) and another one in integer
form (for the rest of the functions that take the version as a parameter). I
think it'd be a better option to use a macro to stringify the version number
from the integer constants and avoid the snprintf entirely:

#define str(s) #s
#define VERSION_STR(maj, min, rev) str(maj) "." str(min) "." str(rev)

...

table = utf8_load(VERSION_STR(latest_maj, latest_min, latest_rev));


This way we can define the version constant only once, in integer form, and
then the string form will be a constant generated at compile time. Are you ok
with this?

Cheers,
Ricardo



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux