99 * | Mikachu2333 <mikachu.23333@zohomail.com>
1010 * |
1111 * Created On : <2023-08-28>
12- * Last Modified : <2025-08-17 >
12+ * Last Modified : <2025-08-18 >
1313 *
1414 * xy: 襄阳、咸阳
1515 * Corss-Platform C11 utilities for CLI applications in mixed
1919#ifndef XY_H
2020#define XY_H
2121
22- #define _XY_Version "v0.1.5.6-2025/08/17 "
22+ #define _XY_Version "v0.1.5.6-2025/08/18 "
2323#define _XY_Maintain_URL "https://github.com/RubyMetric/chsrc/blob/dev/lib/xy.h"
2424#define _XY_Maintain_URL2 "https://gitee.com/RubyMetric/chsrc/blob/dev/lib/xy.h"
2525
@@ -104,16 +104,16 @@ bool xy_enable_color = true;
104104
105105#define assert_str (a , b ) assert (xy_streql ((a), (b)))
106106
107- #define xy_unsupported () assert (!"Unsuppoted")
108- #define xy_unimplemented () assert (!"Unimplemented temporarily")
109- #define xy_unreached () assert (!"This code shouldn't be reached")
107+ #define xy_unsupported () assert(!"Unsuppoted")
108+ #define xy_unimplemented () assert(!"Unimplemented temporarily")
109+ #define xy_unreached () assert(!"This code shouldn't be reached")
110110
111111static void _xy_print_int (int n ) {printf ("%d" , n );}
112112static void _xy_print_long (long n ) {printf ("%ld" , n );}
113113static void _xy_print_long_long (long long n ) {printf ("%lld" , n );}
114114static void _xy_print_float (float n ) {printf ("%f" , n );}
115115static void _xy_print_double (double n ) {printf ("%f" , n );}
116- static void _xy_print_bool (bool b ) {printf ("%s" , (b ) ? "true" : "false" );}
116+ static void _xy_print_bool (bool b ) {printf ("%s" , (b ) ? "true" : "false" );}
117117static void _xy_print_str (char * str ) {printf ("%s" , str );}
118118static void _xy_print_const_str (const char * str ) {printf ("%s" , str );}
119119
@@ -122,7 +122,7 @@ static void _xy_println_long (long n) {printf ("%ld\n", n);}
122122static void _xy_println_long_long (long long n ) {printf ("%lld\n" , n );}
123123static void _xy_println_float (float n ) {printf ("%f\n" , n );}
124124static void _xy_println_double (double n ) {printf ("%f\n" , n );}
125- static void _xy_println_bool (bool b ) {printf ("%s\n" , (b ) ? "true" : "false" );}
125+ static void _xy_println_bool (bool b ) {printf ("%s\n" , (b ) ? "true" : "false" );}
126126static void _xy_println_str (char * str ) {printf ("%s\n" , str );}
127127static void _xy_println_const_str (const char * str ) {printf ("%s\n" , str );}
128128
@@ -135,7 +135,7 @@ static void _xy_println_const_str (const char *str) {printf ("%s\n", str);}
135135 bool: _xy_print_bool, \
136136 char *: _xy_print_str, \
137137 const char *: _xy_print_const_str, \
138- default: assert (!"Unsupported type for print()!") \
138+ default: assert(!"Unsupported type for print()!") \
139139)(x)
140140
141141#define println (x ) _Generic((x), \
@@ -147,7 +147,7 @@ static void _xy_println_const_str (const char *str) {printf ("%s\n", str);}
147147 bool: _xy_println_bool, \
148148 char *: _xy_println_str, \
149149 const char *: _xy_println_const_str, \
150- default: assert (!"Unsupported type for println()/say()!") \
150+ default: assert(!"Unsupported type for println()/say()!") \
151151)(x)
152152#define say println
153153
@@ -205,7 +205,7 @@ xy_str_gsub (const char *str, const char *pat, const char *replace)
205205 else
206206 break ;
207207 }
208- // puti (count); DEBUG 匹配次数
208+ // puti(count); DEBUG 匹配次数
209209
210210 char * ret = malloc (unit * count + len + 1 );
211211 char * retcur = ret ;
@@ -266,7 +266,7 @@ xy_strjoin (unsigned int count, ...)
266266 const char * str = NULL ;
267267 // 需要分配的量
268268 size_t al_need = 0 ;
269- // 用于 strcpy () 到 ret 的哪个位置
269+ // 用于 strcpy() 到 ret 的哪个位置
270270 char * cur = ret + 0 ;
271271
272272 va_list args ;
@@ -284,7 +284,7 @@ xy_strjoin (unsigned int count, ...)
284284 al_cur = al_times * al_fixed ;
285285 need_realloc = true;
286286 }
287- // printf ("al_times %d, al_need %zd, al_cur %zd\n", al_times, al_need,
287+ // printf("al_times %d, al_need %zd, al_cur %zd\n", al_times, al_need,
288288 // al_cur);
289289 if (need_realloc )
290290 {
@@ -298,7 +298,7 @@ xy_strjoin (unsigned int count, ...)
298298 return NULL ;
299299 }
300300 strcpy (cur , str );
301- // puts (ret);
301+ // puts(ret);
302302 cur += strlen (str );
303303 }
304304 va_end (args );
@@ -422,23 +422,23 @@ xy_streql (const char *str1, const char *str2)
422422
423423
424424static bool
425- xy_streql_ic (const char * str1 , const char * str2 )
425+ xy_streql_ic (const char * str1 , const char * str2 )
426426{
427427 if (NULL == str1 || NULL == str2 )
428428 {
429429 return false;
430430 }
431431
432- size_t len1 = strlen (str1 );
433- size_t len2 = strlen (str2 );
432+ size_t len1 = strlen (str1 );
433+ size_t len2 = strlen (str2 );
434434 if (len1 != len2 )
435435 {
436436 return false;
437437 }
438438
439439 for (size_t i = 0 ; i < len1 ; i ++ )
440440 {
441- if (tolower (str1 [i ]) != tolower (str2 [i ]))
441+ if (tolower (str1 [i ]) != tolower (str2 [i ]))
442442 {
443443 return false;
444444 }
0 commit comments