Skip to content

Commit 7d230bc

Browse files
committed
重命名为 xy_run_iter_lines()
1 parent f195709 commit 7d230bc

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

lib/xy.h

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -761,20 +761,20 @@ _xy_log_brkt (int level, const char *prompt1, const char *prompt2, const char *c
761761
******************************************************/
762762

763763
/**
764-
* @brief 执行cmd,返回某行输出结果,并对已经遍历过的行执行iter_func
764+
* @brief 执行 `cmd`,返回某行输出结果,并对已经遍历过的行执行 `func`
765765
*
766-
* @param cmd 要执行的命令
767-
* @param n 指定命令执行输出的结果行中的某一行,0 表示最后一行,n (n>0) 表示第n行
768-
* @param iter_func 对遍历时经过的行的内容,进行函数调用
766+
* @param cmd 要执行的命令
767+
* @param n 指定命令执行输出的结果行中的某一行,0 表示最后一行,n (n>0) 表示第n行
768+
* @param func 对遍历时经过的行的内容,进行函数调用
769769
*
770-
* @return 该函数会返回 参数 n 指定的该行的内容
770+
* @return 返回第 `n` 行的内容
771771
*
772772
* @note 返回的字符串最后面一般有换行符号
773773
*
774-
* 由于目标行会被返回出来,所以 iter_func() 并不执行目标行,只会执行遍历过的行
774+
* 由于目标行会被返回出来,所以 `func` 并不执行目标行,只会执行遍历过的行
775775
*/
776776
static char *
777-
xy_run_iter (const char *cmd, unsigned long n, void (*iter_func) (const char *))
777+
xy_run_iter_lines (const char *cmd, unsigned long n, void (*func) (const char *))
778778
{
779779
const int size = 512;
780780
char *buf = (char *) malloc (size);
@@ -798,9 +798,9 @@ xy_run_iter (const char *cmd, unsigned long n, void (*iter_func) (const char *
798798
count += 1;
799799
if (n == count)
800800
break;
801-
if (iter_func)
801+
if (func)
802802
{
803-
iter_func (buf);
803+
func (buf);
804804
}
805805
}
806806

@@ -811,7 +811,7 @@ xy_run_iter (const char *cmd, unsigned long n, void (*iter_func) (const char *
811811
static char *
812812
xy_run (const char *cmd, unsigned long n)
813813
{
814-
return xy_run_iter (cmd, n, NULL);
814+
return xy_run_iter_lines (cmd, n, NULL);
815815
}
816816

817817

src/recipe/lang/Ruby/Ruby.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ pl_ruby_setsrc (char *option)
7676
char *cmd = NULL;
7777

7878
// step1
79-
xy_run_iter ("gem sources -l", 0, pl_ruby_remove_gem_source);
79+
xy_run_iter_lines ("gem sources -l", 0, pl_ruby_remove_gem_source);
8080

8181
cmd = xy_2strcat ("gem source -a ", source.url);
8282
chsrc_run (cmd, RunOpt_Default);

0 commit comments

Comments
 (0)