mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-14 15:40:19 +02:00
micro-optimizations to string-trim-both, and to (web http)
* libguile/srfi-13.c (scm_string_trim, scm_string_trim_right) (scm_string_trim_both): Take the whitespace fast-path if the char_pred is scm_char_set_whitespace. * module/web/http.scm (read-header, split-and-trim, parse-quality-list): (parse-param-component, parse-credentials, "Content-Type"): (read-request-line, read-response-line): Use char-set:whitespace instead of char-whitespace?. It avoids recursing into the VM.
This commit is contained in:
parent
c05805a4ea
commit
47153f29b0
2 changed files with 27 additions and 28 deletions
|
@ -1,6 +1,6 @@
|
|||
/* srfi-13.c --- SRFI-13 procedures for Guile
|
||||
*
|
||||
* Copyright (C) 2001, 2004, 2005, 2006, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
|
||||
* Copyright (C) 2001, 2004, 2005, 2006, 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
|
@ -719,7 +719,8 @@ SCM_DEFINE (scm_string_trim, "string-trim", 1, 3, 0,
|
|||
MY_VALIDATE_SUBSTRING_SPEC (1, s,
|
||||
3, start, cstart,
|
||||
4, end, cend);
|
||||
if (SCM_UNBNDP (char_pred))
|
||||
if (SCM_UNBNDP (char_pred)
|
||||
|| scm_is_eq (char_pred, scm_char_set_whitespace))
|
||||
{
|
||||
while (cstart < cend)
|
||||
{
|
||||
|
@ -794,7 +795,8 @@ SCM_DEFINE (scm_string_trim_right, "string-trim-right", 1, 3, 0,
|
|||
MY_VALIDATE_SUBSTRING_SPEC (1, s,
|
||||
3, start, cstart,
|
||||
4, end, cend);
|
||||
if (SCM_UNBNDP (char_pred))
|
||||
if (SCM_UNBNDP (char_pred)
|
||||
|| scm_is_eq (char_pred, scm_char_set_whitespace))
|
||||
{
|
||||
while (cstart < cend)
|
||||
{
|
||||
|
@ -869,7 +871,8 @@ SCM_DEFINE (scm_string_trim_both, "string-trim-both", 1, 3, 0,
|
|||
MY_VALIDATE_SUBSTRING_SPEC (1, s,
|
||||
3, start, cstart,
|
||||
4, end, cend);
|
||||
if (SCM_UNBNDP (char_pred))
|
||||
if (SCM_UNBNDP (char_pred)
|
||||
|| scm_is_eq (char_pred, scm_char_set_whitespace))
|
||||
{
|
||||
while (cstart < cend)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue