diff options
| author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-02-23 21:13:05 +0000 |
|---|---|---|
| committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-02-23 21:13:05 +0000 |
| commit | 272391d88504f745c79169f5809353ccc39b58b2 (patch) | |
| tree | 2c751d83a3a4d15fe94ab76fb40d5c1091a095f4 /util.c | |
| parent | e67f83271e28da8b087310db8ae21c1b2767c91d (diff) | |
| download | ruby-272391d88504f745c79169f5809353ccc39b58b2.tar.gz ruby-272391d88504f745c79169f5809353ccc39b58b2.tar.xz ruby-272391d88504f745c79169f5809353ccc39b58b2.zip | |
* debug.c (ruby_set_debug_option): separated ruby_each_words().
* util.c (ruby_each_words): extracted from ruby_set_debug_option().
* ruby.c (proc_options): generalized enable/disable options.
* ruby.c (ruby_init_gems): take enabled flag. [ruby-core:14840]
* ruby.c (process_options): added --disable-rubyopt flag.
* include/ruby/util.h (ruby_each_words): prototype.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@15590 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'util.c')
| -rw-r--r-- | util.c | 18 |
1 files changed, 18 insertions, 0 deletions
@@ -3936,6 +3936,24 @@ ret1: *rve = s; return s0; } + +void +ruby_each_words(const char *str, void (*func)(const char*, int, void*), void *arg) +{ + const char *end; + int len; + + if (!str) return; + for (; *str; str = end) { + while (ISSPACE(*str) || *str == ',') str++; + if (!*str) break; + end = str; + while (*end && !ISSPACE(*end) && *end != ',') end++; + len = end - str; + (*func)(str, len, arg); + } +} + #ifdef __cplusplus } #endif |
