Rename some functions

This commit is contained in:
Aoran Zeng 2023-08-30 08:31:46 +08:00
parent 91fc38c2a5
commit cc43c517b3
3 changed files with 8 additions and 9 deletions

12
chsrc.c
View File

@ -2,7 +2,7 @@
* File : chsrc.c * File : chsrc.c
* Authors : Aoran Zeng <ccmywish@qq.com> * Authors : Aoran Zeng <ccmywish@qq.com>
* Created on : <2023-08-28> * Created on : <2023-08-28>
* Last modified : <2023-08-29> * Last modified : <2023-08-30>
* *
* chsrc: * chsrc:
* *
@ -22,7 +22,7 @@
* https://mirrors.tuna.tsinghua.edu.cn/help/pypi/ * https://mirrors.tuna.tsinghua.edu.cn/help/pypi/
*/ */
void void
pl_chsrc_python (char* source_name) pl_python_chsrc (char* source_name)
{ {
char* source_url = NULL; char* source_url = NULL;
@ -48,7 +48,7 @@ pl_chsrc_python (char* source_name)
* https://gitee.com/RubyKids/rbenv-cn * https://gitee.com/RubyKids/rbenv-cn
*/ */
void void
pl_chsrc_ruby (char* option) pl_ruby_chsrc (char* option)
{ {
int selected = 0; int selected = 0;
for (int i=0;i<sizeof(pl_ruby_sources);i++) { for (int i=0;i<sizeof(pl_ruby_sources);i++) {
@ -78,7 +78,7 @@ pl_chsrc_ruby (char* option)
#define cmdfunc(func) (const char const*)func #define cmdfunc(func) (const char const*)func
static const char const static const char const
*pl_ruby[] = {"gem", "ruby", "rb", NULL, cmdfunc(pl_chsrc_ruby)}, *pl_ruby[] = {"gem", "ruby", "rb", NULL, cmdfunc(pl_ruby_chsrc)},
*pl_python[] = {"pip", "python", "py", NULL}, *pl_python[] = {"pip", "python", "py", NULL},
*pl_nodejs[] = {"npm", "node", "nodejs", "js", NULL}, *pl_nodejs[] = {"npm", "node", "nodejs", "js", NULL},
*pl_perl[] = {"perl", "cpan", NULL}, *pl_perl[] = {"perl", "cpan", NULL},
@ -125,7 +125,7 @@ call_cmd (void* cmdptr, const char* arg)
int int
print_help () print_help ()
{ {
for (int i=0; i<ARRAY_SIZE(usage); i++) { for (int i=0; i<Array_Size(usage); i++) {
puts(usage[i]); puts(usage[i]);
} }
} }
@ -164,7 +164,7 @@ main (int argc, char const *argv[])
int matched = 0; int matched = 0;
for (int i=0; i<ARRAY_SIZE(pl_packagers); i++) { for (int i=0; i<Array_Size(pl_packagers); i++) {
const char const** packager = pl_packagers[i]; const char const** packager = pl_packagers[i];
int k = 0; int k = 0;
const char* alias = packager[k]; const char* alias = packager[k];

View File

@ -2,14 +2,13 @@
* File : chsrc.h * File : chsrc.h
* Authors : Aoran Zeng <ccmywish@qq.com> * Authors : Aoran Zeng <ccmywish@qq.com>
* Created on : <2023-08-29> * Created on : <2023-08-29>
* Last modified : <2023-08-29> * Last modified : <2023-08-30>
* *
* chsrc: * chsrc:
* *
* chsrc.c * chsrc.c
* -------------------------------------------------------------*/ * -------------------------------------------------------------*/
typedef struct { typedef struct {
const char* abbr; const char* abbr;
const char* name; const char* name;

View File

@ -19,7 +19,7 @@
#define xy_useutf8() #define xy_useutf8()
#endif #endif
#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0])) #define Array_Size(x) (sizeof(x) / sizeof(x[0]))
char* char*
xy_strjoin (const char* str1, const char* str2) xy_strjoin (const char* str1, const char* str2)