-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
use regular expression instead of hand written strchr search #22
Comments
Cc xiehuc, the maintainer of lwqq/pidgin-lwqq On Wed, Jul 24, 2013 at 10:33 AM, microcai [email protected] wrote:
Best Regards, Dunrong Huang Homepage: http://mathslinux.org |
Cc xiehuc, the maintainer of lwqq/pidgin-lwqq On Wed, Jul 24, 2013 at 10:35 AM, microcai [email protected] wrote:
Best Regards, Dunrong Huang Homepage: http://mathslinux.org |
do simple job strstr is enough. and speed is much faster than regular 2013/7/24 mathslinux [email protected]
|
well the "speed exclusive" is just BS. and you won't even import huge regex library into lwqq, posix just have it. glibc has regex functionality right from the start. the code seem to be simple, but definitely not elegant . |
2013/7/24 microcai [email protected]
|
如果当心 windows 下的 libc 没有 regex 支持, 可以使用 glib. pidgin 依赖 glib , 因此完全可以使用 glib 里的 regex |
edo, 虽然pidgin-lwqq是依赖的glib, 2013/7/24 microcai [email protected]
|
2013/7/24 xiehuc [email protected]
而且我当时还设想让 lwqq 在没有 glib 的环境下用(有的机器除了kernel和基本的开发库, 就什么也没有了, 比如我们公司的某些服务器) 当时的 API 由于时间关系我没有设计异步的版本, 而且很多 hardcode, 但是这点 @xiehuc 已经解决得很好了, 参见他的 anyway, patches are welcome!
Best Regards, Dunrong Huang Homepage: http://mathslinux.org |
@xiehuc 如今 lwqq 都依赖上 js 引擎了, 区区一个 regex 就不在话下了吧。。。。。。 |
是, 但是还是感觉用了regex 没有什么本质的变化啊. 其实现在这样也挺易读的. 性能方面也没什么问题. 2015-03-13 12:54 GMT+08:00 microcai [email protected]:
|
I seen a lot of hand written code to match the returning results of webqq server. However, such code can be easily replaced by one line regular expression match.
example:
get_verify_code can use this regular expression
"ptui_checkVC('([\d])',[ ]?'([\d\A\a!])',[ ]?'([\d\a\A\])'"
and to parse the do_login result, this regular expression can be used
"ptuiCB('([\d])',[ ]?'([\d])',[ ]?'([^'])',[ ]?'([\d])',[ ]?'([^'])',[ ]?'([^'])'[ ]);"
The text was updated successfully, but these errors were encountered: