Assar Westerlund <[EMAIL PROTECTED]> writes: > Dag-Erling Smorgrav <[EMAIL PROTECTED]> writes: > > + realpat = grep_malloc(strlen(pattern) + sizeof("^(") > > + + sizeof(")$") + 1); > Why not just use asprintf? Doesn't matter, thsis code is gone in the latest version. You though the linux 'kernel of the day' was bad; now you have the FreeBSD 'grep of the minute' :) > In this case it doesn't matter but in general this function is wrong. > malloc(0) can return NULL. Agreed. > And besides, I really don't think this is a grep function but actually > is useful for programs that don't have any strategy for handling out > of memory errors and might as well die (with a descriptive error > message, of course). Let's call it emalloc and let's put in somewhere > where it can be used. Too simple to warrant that, and other programs will likely want to handle the error differently. DES -- Dag-Erling Smorgrav - [EMAIL PROTECTED] To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-hackers" in the body of the message
- Re: Repalcement for grep(1) Dag-Erling Smorgrav
- Re: Replacement for grep(1) (part 2) Jamie Howard
- Re: Replacement for grep(1) (part 2) Sheldon Hearn
- Re: Replacement for grep(1) (part 2) Jake Burkholder
- Re: Replacement for grep(1) (part 2) Jamie Howard
- Re: Replacement for grep(1) (part 2) Dag-Erling Smorgrav
- Re: Replacement for grep(1) (part 2) Dag-Erling Smorgrav
- Re: Replacement for grep(1) (part 2) Dag-Erling Smorgrav
- Re: Replacement for grep(1) (part 2) Dag-Erling Smorgrav
- Re: Replacement for grep(1) (part 2) Assar Westerlund
- Re: Replacement for grep(1) (part 2) Dag-Erling Smorgrav
- Re: Replacement for grep(1) (par... Assar Westerlund
- Re: Replacement for grep(1) ... Daniel C. Sobral
- Re: Replacement for grep(1) ... Jon Ribbens
- Re: Replacement for grep(1) ... Daniel C. Sobral
- Re: Replacement for grep(1) ... Jon Ribbens
- Re: Replacement for grep(1) ... Daniel C. Sobral
- Re: Replacement for grep(1) ... Jon Ribbens
- Re: Replacement for grep(1) ... Sheldon Hearn
- Re: Replacement for grep(1) ... Jon Ribbens
- Re: Replacement for grep(1) ... Sheldon Hearn