Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Mon, 13 Jul 2015 11:19:16 +0800
From: Kai Zhao <loverszhao@...il.com>
To: john-dev@...ts.openwall.com
Subject: Re: more robustness

Hi Alexander Cherepanov,

> If you are reading a whole file into memory (and I think we are not
> concerned with reading from pipes) then it's easier to get its size and
> allocate its full size in one go and read it in as one chunk. Then got
> through it replacing \n with 0 and saving addresses in a list. Or
eliminate
> the list entirely.

Thanks for your advice. I will follow your idea. I will use mmap() to read
the whole file into memory. It will be more efficient.

> Why don't you use strcpy and other str* functions here and in similar
> cases?

Use str* functions is ok too. It's just my habit, maybe not good.

> In many cases you put a constant in a comparison on the left. It was
> useful to some degree some time ago (to catch = instead of == in
> conditions). But it's quite unintuitive and current compilers warn
> about most improper cases (if you don't have parenthesis around
> the comparison).
>
> IMHO it's better to move all constants to the right.

Yes, I will change those comparisons.

> And my personal preference is to drop checks "!= NULL" completely.
> But this is something for a debate.

Do you mean that use "if (pointer)" instead of "if (pointer != NULL)" ?
I am used to use the "if (pointer != NULL)", but most of the code in JtR
use "if (pointer)". I will change my style.

Thanks,

kai

Content of type "text/html" skipped

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.