[RFC/PATCH v2 3/5] libbb: add ends_with() function

Xabier Oneca -- xOneca xoneca at gmail.com
Fri Aug 21 22:11:54 UTC 2015


Hello,

2015-08-21 23:26 GMT+02:00 Tito <farmatito at tiscali.it>:
> what sense would it make to check if str\0 ends_with \0 if all strings do
> end with \0 ?

It can be helpful when key is dynamically created (e.g. extracted from
a string) and it comes as an empty string.

But it also depends on context: If it is too often checked that (*key
== 0) before calling ends_with, it makes sense to embed that check in
ends_with. If it doesn't matter, then why make the code (and binary)
bigger?

Cheers,

Xabier Oneca_,,_


More information about the busybox mailing list