Project

General

Profile

Backport #5099 ยป ruby-1.9.2-p290-load-path-backport.diff

Backport patch against ruby-1.9.2-p290 - cwgem (Chris White), 08/04/2011 03:09 AM

View differences:

ruby-1.9.2-p290/load.c 2011-08-03 11:00:30.000000000 -0700
73 73
		    int type, VALUE load_path)
74 74
{
75 75
    long i;
76
    long plen;
77
    const char *e;
76 78

  
79
    if(vlen < len) return 0;
80
    if (!strncmp(name+(vlen-len),feature,len)){
81
	plen = vlen - len - 1;
82
    } else {
83
	for (e = name + vlen; name != e && *e != '.' && *e != '/'; --e);
84
	if (*e!='.' ||
85
	    e-name < len ||
86
	    strncmp(e-len,feature,len) )
87
	    return 0;
88
	plen = e - name - len - 1;
89
    }
77 90
    for (i = 0; i < RARRAY_LEN(load_path); ++i) {
78 91
	VALUE p = RARRAY_PTR(load_path)[i];
79 92
	const char *s = StringValuePtr(p);
80 93
	long n = RSTRING_LEN(p);
81 94

  
82
	if (vlen < n + len + 1) continue;
95
	if (n != plen ) continue;
83 96
	if (n && (strncmp(name, s, n) || name[n] != '/')) continue;
84
	if (strncmp(name + n + 1, feature, len)) continue;
85
	if (name[n+len+1] && name[n+len+1] != '.') continue;
86 97
	switch (type) {
87 98
	  case 's':
88 99
	    if (IS_DLEXT(&name[n+len+1])) return p;