8000 options, refactor: update string helper function to handle paths corr… · fibjs/fibjs@48ea014 · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Commit 48ea014

Browse files
committed
options, refactor: update string helper function to handle paths correctly.
1 parent 188b2a4 commit 48ea014

File tree

2 files changed

+29
-19
lines changed

2 files changed

+29
-19
lines changed

fibjs/scripts/internal/helpers/string.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
11
exports.find_least_common_str = function (str1 = '', str2 = '') {
2-
let idx = 0;
3-
while (str1[idx] === str2[idx]) idx++;
2+
var idx = 0;
3+
var str1_parts = str1.split('/');
4+
var str2_parts = str2.split('/');
45

5-
return str1.slice(0, idx);
6+
while (idx < str1_parts.length - 1 && str1_parts[idx] === str2_parts[idx])
7+
idx++;
8+
9+
if (idx === 0)
10+
return '';
11+
12+
return str1_parts.slice(0, idx).join('/') + '/';
613
}
714

815
exports.ensure_prefix = function (base = '', prefix = '/') {

fibjs/src/base/opt_tools.cpp

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2123,21 +2123,24 @@ static const unsigned char dat_11[] = {
21232123
0xb9, 0x72, 0xad, 0xf7, 0xbf, 0x01, 0xff, 0xb9, 0xad, 0xb6, 0};
21242124

21252125
static const unsigned char dat_12[] = {
2126-
0x78, 0x9c, 0x95, 0x92, 0x4d, 0x4e, 0xc3, 0x30, 0x10, 0x85, 0xf7, 0x3e, 0x85, 0x59, 0x25, 0x56, 0x4a, 0x68, 0xd9, 0x46,
2127-
0x39, 0x00, 0x2b, 0x0e, 0x80, 0x50, 0x54, 0x92, 0x31, 0xb5, 0x94, 0x8e, 0x2b, 0xff, 0x88, 0x48, 0x88, 0xbb, 0x33, 0xfe,
2128-
0x21, 0x6a, 0xaa, 0x54, 0xb4, 0x5e, 0xd9, 0x6f, 0xde, 0x4c, 0x3e, 0xbf, 0x18, 0xa6, 0x93, 0x36, 0xce, 0xd6, 0x52, 0xe1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x7f, 0xcc, 0x0d, 0x8b,
2138-
0x84, 0x93, 0x74, 0xc1, 0x5a, 0xfd, 0xe9, 0x37, 0x66, 0x7b, 0x37, 0x65, 0x8e, 0x36, 0x3d, 0xcc, 0xc4, 0x48, 0xef, 0xfb,
2139-
0x05, 0x07, 0x98, 0x5e, 0x65, 0x79, 0xce, 0x74, 0x71, 0x9f, 0xd0, 0x92, 0x42, 0x5e, 0x05, 0x5f, 0x84, 0x1c, 0x7e, 0x49,
2140-
0xb0, 0xaf, 0x5f, 0xe2, 0x17, 0x36, 0xd4, 0x08, 0xc9, 0};
2126+
0x78, 0x9c, 0x95, 0x53, 0x41, 0x6e, 0x83, 0x30, 0x10, 0xbc, 0xf3, 0x8a, 0xed, 0x25, 0x80, 0x48, 0x69, 0x92, 0x6b, 0xca,
2127+
0x03, 0x7a, 0xea, 0x03, 0xaa, 0x0a, 0x51, 0x62, 0x37, 0x8e, 0x88, 0x41, 0xb6, 0x69, 0x91, 0xa2, 0xfe, 0xbd, 0xbb, 0xb6,
2128+
0x4b, 0x4c, 0x44, 0xd4, 0x84, 0x0b, 0xde, 0xf1, 0xec, 0x78, 0x76, 0xc0, 0x6c, 0xe8, 0x5a, 0x65, 0x74, 0xce, 0x85, 0xdc,
2129+
0x95, 0x0d, 0xab, 0xb4, 0x29, 0xeb, 0xf6, 0x78, 0x6c, 0x65, 0xa9, 0x8d, 0x82, 0x02, 0x78, 0x2f, 0x6b, 0x23, 0x5a, 0x09,
2130+
0x09, 0xd6, 0x6b, 0x04, 0xe2, 0x78, 0x09, 0xb8, 0xdc, 0xd8, 0x65, 0x0a, 0xa7, 0x08, 0xf0, 0xf9, 0xaa, 0x14, 0x88, 0xdd,
2131+
0x80, 0xd8, 0x6a, 0x3b, 0x02, 0xd4, 0x50, 0x76, 0x15, 0xaa, 0x23, 0x4e, 0x45, 0xae, 0xbb, 0x46, 0x98, 0x24, 0x7e, 0x8a,
2132+
0xd3, 0x09, 0x6b, 0x13, 0xb2, 0x36, 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xbc, 0x66, 0x7f, 0xf8, 0x8d, 0xd9, 0xde, 0xed, 0xd2, 0x47, 0xeb, 0x6e, 0x95, 0xf3, 0x88, 0x97, 0xf3,
2142+
0x45, 0xee, 0xd8, 0xf0, 0xca, 0x93, 0xd0, 0xd3, 0xc5, 0x3c, 0xd4, 0xe2, 0x42, 0x9e, 0x35, 0x3e, 0x09, 0x99, 0x3e, 0x09,
2143+
0xd1, 0xe7, 0x87, 0xf8, 0x05, 0x6d, 0x62, 0x3e, 0x13, 0};
21412144

21422145
static const unsigned char dat_13[] = {
21432146
0x78, 0x9c, 0xcd, 0x59, 0x51, 0x73, 0xd3, 0x38, 0x10, 0x7e, 0xef, 0xaf, 0x10, 0x99, 0x39, 0x6a, 0x37, 0x89, 0xdb, 0xa4,
@@ -3995,7 +3998,7 @@ const OptData opt_tools[] = {
39953998
{"internal/helpers/napi", 1850, (const char*)dat_9},
39963999
{"internal/helpers/package", 1152, (const char*)dat_10},
39974000
{"internal/helpers/semver", 10070, (const char*)dat_11},
3998-
{"internal/helpers/string", 289, (const char*)dat_12},
4001+
{"internal/helpers/string", 349, (const char*)dat_12},
39994002
{"internal/helpers/untar", 2055, (const char*)dat_13},
40004003
{"internal/helpers/versioning", 4220, (const char*)dat_14},
40014004
{"internal/primordials", 4915, (const char*)dat_15},

0 commit comments

Comments
 (0)
0