Opened 9 years ago

Closed 9 years ago

#3165 closed enhancement (invalid)

Big cleanout of strcmp

Reported by: theparasol Owned by:
Priority: minor Component: General
Severity: high Keywords:
Cc: Sensitive: no

Description

Replace all strcmp by streq since strcmp is buggy against empty variables. This way I hope to prevent rare oscam issues.

Since this is a big change there could be introduced new bugs so we need to test it out before committing.

Attachments (1)

strcmp2streq_v1.patch (55.5 KB ) - added by theparasol 9 years ago.
First attempt to replace all strcmp by streq

Download all attachments as: .zip

Change History (6)

by theparasol, 9 years ago

Attachment: strcmp2streq_v1.patch added

First attempt to replace all strcmp by streq

comment:1 by gf, 9 years ago

Most of these can never be NULL, so changing them just slows down the code a bit.

Although I'm a fen of streq() /I have introduced it/ I'm against such global change even if I hate the fact that !strcmp(a, b) means a and b are the same :)

comment:2 by theparasol, 9 years ago

Ok, makes sense. While going through all strcmp occurences I also found this but by using strcmp all over the code it looks inviting for other coders to use it instead of streq.

Then perhaps just replace it in places where one or more non static vars are in use?
Does is really slow down that much?

comment:3 by gf, 9 years ago

The slowdown can't be measured its really, really small. Maybe replace only when one of the arguments is char *, in that case there is a possibility of NULL. When both arguments are char[x] it makes no sense to use streq().

comment:4 by Admin, 9 years ago

So what do we do here?

comment:5 by Deas, 9 years ago

Resolution: invalid
Status: newclosed

we close it!

Note: See TracTickets for help on using tickets.