Mercurial > hg > Members > shinya > pyrect
changeset 72:8b9c3a924744
rename memrchr -> beg_get_line.
author | Ryoma SHINYA <shinya@firefly.cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Sun, 07 Nov 2010 14:28:39 +0900 |
parents | 3be07ba2d648 |
children | a6a0504dea7b |
files | pyrect/translator/grep_translator.py pyrect/translator/template/grep.c |
diffstat | 2 files changed, 5 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/pyrect/translator/grep_translator.py Sun Nov 07 13:45:20 2010 +0900 +++ b/pyrect/translator/grep_translator.py Sun Nov 07 14:28:39 2010 +0900 @@ -91,11 +91,11 @@ self.emit("buf -= %d;" % l) self.emit("%s(%s);" % (self.state_name(self.cg.start) ,self.args)) else: - self.emit("beg = memrchr(buf, '\\n', beg);") + self.emit("beg = get_line_beg(buf, beg);") self.emit("buf = beg;") self.emit("%s(%s);" % (self.state_name(self.cg.start), self.args)) - self.emit("UCHARP memrchr(UCHARP p, int c, UCHARP beg);", 2) + self.emit("UCHARP get_line_beg(UCHARP p, UCHARP beg);", 2) self.emiti("void bm_filter(%s) {" % self.interface) l = len(key) @@ -161,7 +161,7 @@ self.emiti("void accept(%s) {" % self.interface) self.emit( "UCHARP ret = (UCHARP)memchr(buf, '\\n', (buf - end));") if self.skip_boost or self.filter: - self.emit( "beg = memrchr(buf, '\\n', beg);") + self.emit( "beg = get_line_beg(buf, beg);") self.emit( 'if (ret == NULL) ret = end;') self.emiti( "if (ret > end) {") self.emit( "print_line(beg, end);")
--- a/pyrect/translator/template/grep.c Sun Nov 07 13:45:20 2010 +0900 +++ b/pyrect/translator/template/grep.c Sun Nov 07 14:28:39 2010 +0900 @@ -1,6 +1,6 @@ -UCHARP memrchr(UCHARP p, int c, UCHARP beg) { +UCHARP get_line_beg(UCHARP p, UCHARP beg) { while(p > beg) { - if ((*--p) == c) return p+1; + if ((*--p) == '\n') return p+1; } return beg; }