Skip to contentSkip to conversation

Missing code in options.c ?

DISCUSSION Erwan Velu 2 participants 2 messages Apr 2, 2014

lore
Share & tools
lore

Erwan Velu

author
#0 lore raw

Hi Jens,

Sorry for spawning many emails but I think it's easier to follow having an email per problem instead of long emails with mixed stuff in it.

In options.c, we can see that :
http://git.kernel.dk/?p=fio.git;a=blob;f=options.c;h=4a54c98c15045864931ea503d3f7920bab4ae431;hb=HEAD#l212

ret = bssplit_ddir(&td->o, DDIR_READ, str) is performed while ret can be already setup in the previous line. I'm not mastering this part but I wonder what is lacks :

- a missing if (!ret) ?
- some strdup + free around ? Does using str directly is safe here ?

Wouldn't be easier to read to get some goto to the global free code at the end of the function instead of a multiple chained if (!ret) {} ?

Cheers,
Erwan,

#1 lore raw
Quoted 4 lines · Erwan Velu

Hi Jens,

Sorry for spawning many emails but I think it's easier to follow having an email per problem instead of long emails with mixed stuff in it.

No worries, we like hearing about bugs we can get fixed :-)

Quoted 8 lines

In options.c, we can see that :
http://git.kernel.dk/?p=fio.git;a=blob;f=options.c;h=4a54c98c15045864931ea503d3f7920bab4ae431;hb=HEAD#l212

ret = bssplit_ddir(&td->o, DDIR_READ, str) is performed while ret can be already setup in the previous line. I'm not mastering this part but I wonder what is lacks :

Quoted 5 lines

- a missing if (!ret) ?
- some strdup + free around ? Does using str directly is safe here ?

Wouldn't be easier to read to get some goto to the global free code at the end of the function instead of a multiple chained if (!ret) {} ?

I need to take a closer look at that part. It does look a bit messy.

Signature · 1 line
Jens Axboe