Rockbox mail archive
Subject: strtok_r problem
From: Benjamin (mailinglists_at_samuraipanda.com)
One of Björn for improving the bookmarking code was the use of strtok_r
instead of a local function (bookmark_get_next_field()). I had actually
started with strtok_r, but didn't have much sucess. Essentially
what is happening is that the function that calls strtok_r fails
while the same function using bookmark_get_next_field() succeeds.
To top it off, the failing function doesn't always fail (works
when called from one function, but not another). Well, I spent part
of yesterday and most of today trying to figure out what was happening
without much success so I hoping that a second (third, forth, etc)
set of eyes will see what I'm missing.
Attached are two diffs, one with strtok_r() and one with bookmark_get_next_field().
Your help is appreciated. Here's the steps to reproduce the problem
I am experiencing.
1. Create a bookmark file with a couple of bookmarks in it.
2. From the directory browser, load the bookmark file. With the
strtok_r calls, this will fail, showing the bookmark menu with bogus
information. With the the bookmark_get_next_field(), this will show
the correct data.
Here are some investigative notes I've made:
1. In both cases, using autoload will succeed, even though they
call the same basic functions.
2. Using bookmark_debug_print(), I was able to see that the values
coming into bookmark_parse() were NULL for everything except the
3. I hate memory bugs!!!
Thanks for any help you can provide.
- application/x-zip-compressed attachment: diffs.zip
Page was last modified "Jan 10 2012" The Rockbox Crew