Skip to content

find() and find_last() functions return ambiguous value #58

@clalancette

Description

@clalancette

If a NULL or empty string is passed into rcutils_find() or rcutils_find_last(), they return 0. However, it may also be the case that the delimiter being searched for is in the zero'th position, and the caller doesn't have any way to disambiguate this. As discussed in #57 (review), we should probably change this so that rcutils and rcutils_find_last return something different; either a negative value (which would require us to change the return type), or the size of the string (indicating it wasn't found). The latter will obviously only work on empty strings, not NULL arguments. In either case, we need to audit all of the callers and make sure they do the correct thing.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions