-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path3694-0008-mc_search__hex_translate_to_regex-rename-variables.patch
90 lines (81 loc) · 3 KB
/
3694-0008-mc_search__hex_translate_to_regex-rename-variables.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
From 5c8662cf6bbbb4fb72b90426e4f6935fea801ce6 Mon Sep 17 00:00:00 2001
From: Mooffie <mooffie@gmail.com>
Date: Mon, 26 Sep 2016 00:55:41 +0300
Subject: [PATCH 8/8] (mc_search__hex_translate_to_regex): rename variables.
Now that the string isn't duplicated there's nothing "temporary" about it.
---
lib/search/hex.c | 30 +++++++++++++++---------------
1 file changed, 15 insertions(+), 15 deletions(-)
diff --git a/lib/search/hex.c b/lib/search/hex.c
index a0a3c19..a3fa80b 100644
--- a/lib/search/hex.c
+++ b/lib/search/hex.c
@@ -58,33 +58,33 @@ mc_search__hex_translate_to_regex (const GString * astr, mc_search_hex_parse_err
int *error_pos_ptr)
{
GString *buff;
- const char *tmp_str;
- gsize tmp_str_len;
+ const char *str;
+ gsize str_len;
gsize loop = 0;
mc_search_hex_parse_error_t error = MC_SEARCH_HEX_E_OK;
buff = g_string_sized_new (64);
- tmp_str = astr->str;
- tmp_str_len = astr->len;
+ str = astr->str;
+ str_len = astr->len;
- while (loop < tmp_str_len && error == MC_SEARCH_HEX_E_OK)
+ while (loop < str_len && error == MC_SEARCH_HEX_E_OK)
{
unsigned int val;
int ptr;
- if (g_ascii_isspace (tmp_str[loop]))
+ if (g_ascii_isspace (str[loop]))
{
/* Eat-up whitespace between tokens. */
- while (g_ascii_isspace (tmp_str[loop]))
+ while (g_ascii_isspace (str[loop]))
loop++;
}
- else if (tmp_str[loop] == '0' && (tmp_str[loop + 1] == 'x' || tmp_str[loop + 1] == 'X'))
+ else if (str[loop] == '0' && (str[loop + 1] == 'x' || str[loop + 1] == 'X'))
{
/* Skip 0x prefixes. */
loop += 2;
}
/* cppcheck-suppress invalidscanf */
- else if (sscanf (tmp_str + loop, "%x%n", &val, &ptr) == 1)
+ else if (sscanf (str + loop, "%x%n", &val, &ptr) == 1)
{
if (val > 255)
error = MC_SEARCH_HEX_E_NUM_OUT_OF_RANGE;
@@ -94,23 +94,23 @@ mc_search__hex_translate_to_regex (const GString * astr, mc_search_hex_parse_err
loop += ptr;
}
}
- else if (tmp_str[loop] == '"')
+ else if (str[loop] == '"')
{
gsize loop2;
loop2 = loop + 1;
- while (loop2 < tmp_str_len)
+ while (loop2 < str_len)
{
- if (tmp_str[loop2] == '"')
+ if (str[loop2] == '"')
break;
- if (tmp_str[loop2] == '\\' && loop2 + 1 < tmp_str_len)
+ if (str[loop2] == '\\' && loop2 + 1 < str_len)
loop2++;
- g_string_append_c (buff, tmp_str[loop2]);
+ g_string_append_c (buff, str[loop2]);
loop2++;
}
- if (tmp_str[loop2] == '\0')
+ if (str[loop2] == '\0')
error = MC_SEARCH_HEX_E_UNMATCHED_QUOTES;
else
loop = loop2 + 1;
--
2.9.3