重命名为 xy_run_iter_lines()

This commit is contained in:
Aoran Zeng 2025-08-20 19:52:54 +08:00
parent f195709493
commit 7d230bcf57
No known key found for this signature in database
GPG Key ID: 8F8BA8488E10ED98
2 changed files with 11 additions and 11 deletions

View File

@ -761,20 +761,20 @@ _xy_log_brkt (int level, const char *prompt1, const char *prompt2, const char *c
******************************************************/
/**
* @brief cmditer_func
* @brief `cmd` `func`
*
* @param cmd
* @param n 0 n (n>0) n行
* @param iter_func
* @param cmd
* @param n 0 n (n>0) n行
* @param func
*
* @return n
* @return `n`
*
* @note
*
* iter_func()
* `func`
*/
static char *
xy_run_iter (const char *cmd, unsigned long n, void (*iter_func) (const char *))
xy_run_iter_lines (const char *cmd, unsigned long n, void (*func) (const char *))
{
const int size = 512;
char *buf = (char *) malloc (size);
@ -798,9 +798,9 @@ xy_run_iter (const char *cmd, unsigned long n, void (*iter_func) (const char *
count += 1;
if (n == count)
break;
if (iter_func)
if (func)
{
iter_func (buf);
func (buf);
}
}
@ -811,7 +811,7 @@ xy_run_iter (const char *cmd, unsigned long n, void (*iter_func) (const char *
static char *
xy_run (const char *cmd, unsigned long n)
{
return xy_run_iter (cmd, n, NULL);
return xy_run_iter_lines (cmd, n, NULL);
}

View File

@ -76,7 +76,7 @@ pl_ruby_setsrc (char *option)
char *cmd = NULL;
// step1
xy_run_iter ("gem sources -l", 0, pl_ruby_remove_gem_source);
xy_run_iter_lines ("gem sources -l", 0, pl_ruby_remove_gem_source);
cmd = xy_2strcat ("gem source -a ", source.url);
chsrc_run (cmd, RunOpt_Default);