Re: [PATCH 1/6 v2] mkfs: Save raw user input field to the opts struct
From: Eric Sandeen <hidden>
Date: 2017-08-16 14:42:59
On 8/16/17 4:11 AM, Jan Tulak wrote:
On Wed, Aug 16, 2017 at 1:07 AM, Eric Sandeen [off-list ref] wrote:quoted
On 8/15/17 10:08 AM, Jan Tulak wrote:quoted
Save exactly what the user gave us for every option. This way, we will never lose the information if we need it to print back an issue. (Just add the infrastructure now, used in the next patches.) Signed-off-by: Jan Tulak <redacted>Sorry for not getting to the V1 review, catching up from a week off.I hope you enjoyed your holiday. :-)
...
quoted
quoted
+static char * +get_conf_raw_safe(const struct opt_params *opt, const int subopt) +{ + char *str; + + str = NULL; + + if (get_conf_raw(opt, subopt, &str) == -ENOMEM) { + fprintf(stderr, "Out of memory!");Seems like using strerror() would be better than a hand-rolled, un- translatable string?Every day there is something new. :-)
Yeah, sorry. But in general, strings need to be translatable; (that was pointed out before) and strerror() would do that for your for free.
quoted
quoted
+ return NULL; + }Again, I don't see that any subsequent patches ever call get_conf_raw(); is there any reason to even have this wrapper now?Luis had a pretty strong opinion about having them there when he will need them in his own patches later on and I saw no reason why not to add them right now when the functions are created. After all, they will be useful later on also for me, when I want to limit the amount of asserts and be more return-oriented. It's just not in this patchset.
Hm, ok. Let me reread that, thread - I'm just looking at this patchset as sent. In general, I'm not clear on what your "_safe" and "_unsafe" variants are about but maybe it was discussed in the prior thread I skipped. Thanks, -Eric