diff options
-rw-r--r-- | pjlib-util/include/pjlib-util/scanner.h | 8 | ||||
-rw-r--r-- | pjlib-util/src/pjlib-util/scanner.c | 9 |
2 files changed, 17 insertions, 0 deletions
diff --git a/pjlib-util/include/pjlib-util/scanner.h b/pjlib-util/include/pjlib-util/scanner.h index b8f8f761..59e9efe4 100644 --- a/pjlib-util/include/pjlib-util/scanner.h +++ b/pjlib-util/include/pjlib-util/scanner.h @@ -117,6 +117,14 @@ PJ_DECL(void) pj_cis_add_num( pj_cis_t *cis); PJ_DECL(void) pj_cis_add_str( pj_cis_t *cis, const char *str); /** + * Add specification from another specification. + * + * @param cis The specification is to be set. + * @param rhs The specification to be copied. + */ +PJ_DECL(void) pj_cis_add_cis( pj_cis_t *cis, const pj_cis_t *rhs); + +/** * Delete characters in the specified range from the specification. * * @param cis The scanner character specification. diff --git a/pjlib-util/src/pjlib-util/scanner.c b/pjlib-util/src/pjlib-util/scanner.c index ec215d5f..802cc09e 100644 --- a/pjlib-util/src/pjlib-util/scanner.c +++ b/pjlib-util/src/pjlib-util/scanner.c @@ -72,6 +72,15 @@ PJ_DEF(void) pj_cis_add_str( pj_cis_t *cis, const char *str) } } +PJ_DEF(void) pj_cis_add_cis( pj_cis_t *cis, const pj_cis_t *rhs) +{ + int i; + for (i=0; i<256; ++i) { + if (PJ_CIS_ISSET(rhs, i)) + PJ_CIS_SET(cis, i); + } +} + PJ_DEF(void) pj_cis_del_range( pj_cis_t *cis, int cstart, int cend) { while (cstart != cend) { |