From 249e9c8d6eafc12bd71819e94697e7e2872a23b5 Mon Sep 17 00:00:00 2001
From: Vit Rosin <vit_r@list.ru>
Date: Mon, 8 Mar 2010 11:13:41 +0000
Subject: [PATCH] lib/strutil/strutil8bit.c getting rid of g_strdown
---
lib/strutil/strutil8bit.c | 28 ++++++++++++++++++++++------
1 files changed, 22 insertions(+), 6 deletions(-)
diff --git a/lib/strutil/strutil8bit.c b/lib/strutil/strutil8bit.c
index f8a934f..26d54c6 100644
a
|
b
|
str_8bit_release_search_needle (char *needle, int case_sen) |
574 | 574 | (void) needle; |
575 | 575 | } |
576 | 576 | |
| 577 | static char * |
| 578 | str_8bit_strdown (const char *str) |
| 579 | { |
| 580 | char *rets; |
| 581 | |
| 582 | rets = g_strdup (str); |
| 583 | if (rets == NULL) |
| 584 | return NULL; |
| 585 | |
| 586 | while (*rets) { |
| 587 | *rets = char_tolower (*rets); |
| 588 | rets++; |
| 589 | } |
| 590 | return rets; |
| 591 | } |
| 592 | |
577 | 593 | static const char * |
578 | 594 | str_8bit_search_first (const char *text, const char *search, int case_sen) |
579 | 595 | { |
… |
… |
str_8bit_search_first (const char *text, const char *search, int case_sen) |
582 | 598 | const char *match; |
583 | 599 | size_t offsset; |
584 | 600 | |
585 | | fold_text = (case_sen) ? (char *) text : g_strdown (g_strdup (text)); |
586 | | fold_search = (case_sen) ? (char *) search : g_strdown (g_strdup (search)); |
| 601 | fold_text = (case_sen) ? (char *) text : str_8bit_strdown (text); |
| 602 | fold_search = (case_sen) ? (char *) search : str_8bit_strdown (search); |
587 | 603 | |
588 | 604 | match = g_strstr_len (fold_text, -1, fold_search); |
589 | 605 | if (match != NULL) |
… |
… |
str_8bit_search_last (const char *text, const char *search, int case_sen) |
609 | 625 | const char *match; |
610 | 626 | size_t offsset; |
611 | 627 | |
612 | | fold_text = (case_sen) ? (char *) text : g_strdown (g_strdup (text)); |
613 | | fold_search = (case_sen) ? (char *) search : g_strdown (g_strdup (search)); |
| 628 | fold_text = (case_sen) ? (char *) text : str_8bit_strdown (text); |
| 629 | fold_search = (case_sen) ? (char *) search : str_8bit_strdown (search); |
614 | 630 | |
615 | 631 | match = g_strrstr_len (fold_text, -1, fold_search); |
616 | 632 | if (match != NULL) |
… |
… |
str_8bit_fix_string (char *text) |
680 | 696 | |
681 | 697 | static char * |
682 | 698 | str_8bit_create_key (const char *text, int case_sen) |
683 | | { |
684 | | return (case_sen) ? (char *) text : g_strdown (g_strdup (text)); |
| 699 | { |
| 700 | return (case_sen) ? (char *) text : str_8bit_strdown (text); |
685 | 701 | } |
686 | 702 | |
687 | 703 | static int |