Project

General

Profile

string_lstrip_improvement.patch

asterite (Ary Borenszweig), 09/26/2016 01:02 AM

Download (685 Bytes)

View differences:

string.c (working copy)
8039 8039
    const char *const start = s;
8040 8040

  
8041 8041
    if (!s || s >= e) return 0;
8042

  
8042 8043
    /* remove spaces at head */
8043
    while (s < e) {
8044
	int n;
8045
	unsigned int cc = rb_enc_codepoint_len(s, e, &n, enc);
8044
    if (single_byte_optimizable(str)) {
8045
        while (s < e && ascii_isspace(*s)) s++;
8046
    }
8047
    else {
8048
	while (s < e) {
8049
	    int n;
8050
	    unsigned int cc = rb_enc_codepoint_len(s, e, &n, enc);
8046 8051

  
8047
	if (!rb_isspace(cc)) break;
8048
	s += n;
8052
	    if (!rb_isspace(cc)) break;
8053
	    s += n;
8054
	}
8049 8055
    }
8050 8056
    return s - start;
8051 8057
}