Thanks!  This looks good, up to my late-afternoon ability to review code.
 I trust anyway that you'll eventually test it, too. ;-)

Do you ever allocate or deallocate curname?


Jeff Abrahamson
+33 6 24 40 01 57   <-- brièvement indisponible le 4 juillet
+44 7920 594 255    <-- will change 18 July

http://jeff.purple.com/
http://blog.purple.com/jeff/


On 19 June 2014 19:12, Johannes Altmanninger <[email protected]>
wrote:

>
> On 06/19/2014 03:47 PM, Bernhard R. Link wrote:
>
>> * Jeff Abrahamson <[email protected]> [140618 20:52]:
>>
>>>     - Using raw strcmp() isn't a very good idea -- if one of the strings
>>> is
>>>     not null-terminated, you introduce a subtle bug.  Prefer instead
>>> strncmp()
>>>     and strnlen().  This requires defining some reasonable upper limit on
>>>     window names, of course.
>>>
>> I have to disagree quite vehemently here. Either things are
>> null-terminated or they are not.
>> If they are then introducing a limit where there is not can only
>> produce bugs (subtle and non-subtle).
>> If they are not then most of the time things starting with str* are
>> usually the wrong tools anyway.
>>
>>         Bernhard R. Link
>>
> In this case strncmp() is practical because I do not have to
> write two different blocks for full match and prefix match (atleast until
> I have figured out function pointers).
> strncmp() seems to be safe with a reasonable limit (it stops comparing
> after n bytes as far as I know)
> strnlen() seems unnecessary as the whole program uses strlen()
>
_______________________________________________
Ratpoison-devel mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/ratpoison-devel

Reply via email to