[OpenBIOS] [PATCHv2 1/6] string.fs: add functions to support ROT13 string encoding/decoding

Mark Cave-Ayland mark.cave-ayland at ilande.co.uk
Sun Feb 14 20:05:17 CET 2016


On 14/02/16 15:36, Segher Boessenkool wrote:

> On Sun, Feb 14, 2016 at 11:08:10AM +0000, Mark Cave-Ayland wrote:
>> On 13/02/16 22:47, Segher Boessenkool wrote:
>>
>>> On Sat, Feb 13, 2016 at 04:10:57PM +0000, Mark Cave-Ayland wrote:
>>>> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland at ilande.co.uk>
>>>
>>> Signed-off-by: Segher Boessenkool <segher at kernel.crashing.org>
>>>
>>> Have you tested this?  I just typed it in :-)
>>
>> Indeed, and it actually works!
>>
>>>> +: rot13-str ( str len -- newstr len )
>>>> +  \ Encode copy of input string
>>>> +  strdup 2dup $rot13
>>>> +;
>>>
>>> I would do without this one btw, just put the strdup in the caller.
>>
>> Yeah I'm happy to fold $rot13/rot13-str together but thought there may
>> be another reason for doing it as you suggested. I'll update this for
>> the next revision and add your S-o-B above.
> 
> I only did rot13-str with those semantics because you had it before
> as well :-)  With $rot13 (or call it differently, whatever name fits
> existing practice best) rot13-str is just stringing together two
> unrelated things (well, three: allocation, strdup, rot13), and it's
> not an oft-used phrase, so things are easier to read if you just keep
> it separate.  Very minor, of course.

>From my experience with OpenBIOS, the expectation is that words which
change strings return a copy so I'd be okay to fold these two words
together. Thanks once again :)


ATB,

Mark.




More information about the OpenBIOS mailing list