diff options
author | Diego 'Flameeyes' Pettenò <flameeyes@gmail.com> | 2008-07-08 15:36:07 +0200 |
---|---|---|
committer | Diego 'Flameeyes' Pettenò <flameeyes@gmail.com> | 2008-07-08 15:36:07 +0200 |
commit | 0b504bf028bf83ffc1783ae321f089e7b8406c16 (patch) | |
tree | f98b51b6f097468abc2be62ab1c621d6c8e683ea | |
parent | e9ab9917162330df3239199c2260255462f1cdfe (diff) | |
download | xine-lib-0b504bf028bf83ffc1783ae321f089e7b8406c16.tar.gz xine-lib-0b504bf028bf83ffc1783ae321f089e7b8406c16.tar.bz2 |
Avoid using strlen() in loops, calculate it beforehand.
--HG--
extra : transplant_source : %80%12%03%93%EFL%FC%AF%A6%22Z%D0%95C%D5%29%AF%FB%95%B2
-rw-r--r-- | src/input/input_dvb.c | 11 | ||||
-rw-r--r-- | src/input/libreal/sdpplin.c | 3 |
2 files changed, 8 insertions, 6 deletions
diff --git a/src/input/input_dvb.c b/src/input/input_dvb.c index bc279b78b..19b479a06 100644 --- a/src/input/input_dvb.c +++ b/src/input/input_dvb.c @@ -1664,21 +1664,22 @@ static void load_epg_data(dvb_input_plugin_t *this) } /* Prints text to an area, tries to cut the lines in between words. */ -static void render_text_area(osd_renderer_t* renderer, osd_object_t* osd, char* text, +static void render_text_area(osd_renderer_t* renderer, osd_object_t* osd, const char* text, int x, int y, int row_space, int max_x, int max_y, int* height, int color_base) { /* The position of the text to be printed. */ - char* cursor = text; + const char* cursor = text; + const char *const text_end = text + strlen(text); /* The line to be printed next. */ char text_line[512]; int text_width, text_height; size_t old_line_length, line_cursor; - char* bound, *old_bound; + const char* bound, *old_bound; *height = 0; - while (cursor < text + strlen(text)) { + while (cursor < text_end) { bound = cursor; line_cursor = 0; text_line[0] = '\0'; @@ -1735,7 +1736,7 @@ static void render_text_area(osd_renderer_t* renderer, osd_object_t* osd, char* } /* OK, it did fit, let's try to fit some more. */ - } while (bound < text + strlen(text)); + } while (bound < text_end); if (y + text_height + row_space > max_y) { break; diff --git a/src/input/libreal/sdpplin.c b/src/input/libreal/sdpplin.c index f3672559c..c1fab49c1 100644 --- a/src/input/libreal/sdpplin.c +++ b/src/input/libreal/sdpplin.c @@ -60,7 +60,8 @@ static char *b64_decode(const char *in, char *out, int *size) k=0; /*CONSTANTCONDITION*/ - for (j=0; j<strlen(in); j+=4) + const size_t in_len = strlen(in); + for (j=0; j<in_len; j+=4) { char a[4], b[4]; |