summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar default2024-09-14 18:59:49 +0200
committerGravatar default2024-09-14 18:59:49 +0200
commit31ce1af73630143036d9cfc6a8a5083402f6b7aa (patch)
tree1a2e9318b76010cb28ddcb4e4d31d7bdff91dbc2
parentAlso purge bookmark.idx and draft.idx. (diff)
downloadsnac2-31ce1af73630143036d9cfc6a8a5083402f6b7aa.tar.gz
snac2-31ce1af73630143036d9cfc6a8a5083402f6b7aa.tar.xz
snac2-31ce1af73630143036d9cfc6a8a5083402f6b7aa.zip
Minor code cleaning.
-rw-r--r--xs.h4
-rw-r--r--xs_json.h2
-rw-r--r--xs_version.h2
3 files changed, 6 insertions, 2 deletions
diff --git a/xs.h b/xs.h
index 108b276..9c12c4a 100644
--- a/xs.h
+++ b/xs.h
@@ -157,6 +157,7 @@ unsigned int xs_hash_func(const char *data, int size);
157 157
158#define xs_is_true(v) (xs_type((v)) == XSTYPE_TRUE) 158#define xs_is_true(v) (xs_type((v)) == XSTYPE_TRUE)
159#define xs_is_false(v) (xs_type((v)) == XSTYPE_FALSE) 159#define xs_is_false(v) (xs_type((v)) == XSTYPE_FALSE)
160#define xs_not(v) xs_stock(xs_is_true((v)) ? XSTYPE_FALSE : XSTYPE_TRUE)
160 161
161#define xs_list_foreach(l, v) for (int ct_##__LINE__ = 0; xs_list_next(l, &v, &ct_##__LINE__); ) 162#define xs_list_foreach(l, v) for (int ct_##__LINE__ = 0; xs_list_next(l, &v, &ct_##__LINE__); )
162#define xs_dict_foreach(l, k, v) for (int ct_##__LINE__ = 0; xs_dict_next(l, &k, &v, &ct_##__LINE__); ) 163#define xs_dict_foreach(l, k, v) for (int ct_##__LINE__ = 0; xs_dict_next(l, &k, &v, &ct_##__LINE__); )
@@ -357,6 +358,9 @@ int xs_is_null(const xs_val *data)
357int xs_cmp(const xs_val *v1, const xs_val *v2) 358int xs_cmp(const xs_val *v1, const xs_val *v2)
358/* compares two values */ 359/* compares two values */
359{ 360{
361 if (xs_type(v1) == XSTYPE_STRING && xs_type(v2) == XSTYPE_STRING)
362 return strcmp(v1, v2);
363
360 int s1 = xs_size(v1); 364 int s1 = xs_size(v1);
361 int s2 = xs_size(v2); 365 int s2 = xs_size(v2);
362 int d = s1 - s2; 366 int d = s1 - s2;
diff --git a/xs_json.h b/xs_json.h
index de9600f..69249b1 100644
--- a/xs_json.h
+++ b/xs_json.h
@@ -212,7 +212,7 @@ static xs_val *_xs_json_load_lexer(FILE *f, js_type *t)
212 *t = JS_ERROR; 212 *t = JS_ERROR;
213 213
214 /* skip blanks */ 214 /* skip blanks */
215 while ((c = fgetc(f)) == L' ' || c == L'\t' || c == L'\n' || c == L'\r'); 215 while ((c = fgetc(f)) == ' ' || c == '\t' || c == '\n' || c == '\r');
216 216
217 if (c == '{') 217 if (c == '{')
218 *t = JS_OCURLY; 218 *t = JS_OCURLY;
diff --git a/xs_version.h b/xs_version.h
index a5559d5..8697701 100644
--- a/xs_version.h
+++ b/xs_version.h
@@ -1 +1 @@
/* 2a3ecc6aef531366cfd45cbf19e34a15f83f69f8 2024-08-30T18:33:51+02:00 */ /* 9c3dd1b1165c25baa154e82d8d278926e376af81 2024-09-14T18:18:42+02:00 */