diff options
| author | Hisham Muhammad <hisham@gobolinux.org> | 2017-09-13 13:41:43 -0300 |
|---|---|---|
| committer | Hisham Muhammad <hisham@gobolinux.org> | 2017-09-13 13:41:43 -0300 |
| commit | 147003f6176be5e0ee18011d8e72621fe4df86be (patch) | |
| tree | fe79ab2277521d93baea4c480318c7b4b26a2cf0 /src | |
| parent | 26eba4bcfdb3de662c16f359f66e4240fc9283d4 (diff) | |
| download | luarocks-147003f6176be5e0ee18011d8e72621fe4df86be.tar.gz luarocks-147003f6176be5e0ee18011d8e72621fe4df86be.tar.bz2 luarocks-147003f6176be5e0ee18011d8e72621fe4df86be.zip | |
Speed up type checking
Diffstat (limited to 'src')
| -rw-r--r-- | src/luarocks/core/type_check.lua | 10 | ||||
| -rw-r--r-- | src/luarocks/core/vers.lua | 3 |
2 files changed, 9 insertions, 4 deletions
diff --git a/src/luarocks/core/type_check.lua b/src/luarocks/core/type_check.lua index 343b7154..8b103a58 100644 --- a/src/luarocks/core/type_check.lua +++ b/src/luarocks/core/type_check.lua | |||
| @@ -98,10 +98,12 @@ end | |||
| 98 | -- @see type_check_table | 98 | -- @see type_check_table |
| 99 | local function type_check_item(version, item, typetbl, context) | 99 | local function type_check_item(version, item, typetbl, context) |
| 100 | assert(type(version) == "string") | 100 | assert(type(version) == "string") |
| 101 | 101 | ||
| 102 | local ok, err = check_version(version, typetbl, context) | 102 | if typetbl._version and typetbl._version ~= "1.0" then |
| 103 | if not ok then | 103 | local ok, err = check_version(version, typetbl, context) |
| 104 | return nil, err | 104 | if not ok then |
| 105 | return nil, err | ||
| 106 | end | ||
| 105 | end | 107 | end |
| 106 | 108 | ||
| 107 | local item_type = type(item) or "nil" | 109 | local item_type = type(item) or "nil" |
diff --git a/src/luarocks/core/vers.lua b/src/luarocks/core/vers.lua index 6b6e822e..6920cef0 100644 --- a/src/luarocks/core/vers.lua +++ b/src/luarocks/core/vers.lua | |||
| @@ -126,6 +126,9 @@ end | |||
| 126 | -- @param b string: another version. | 126 | -- @param b string: another version. |
| 127 | -- @return boolean: True if a > b. | 127 | -- @return boolean: True if a > b. |
| 128 | function vers.compare_versions(a, b) | 128 | function vers.compare_versions(a, b) |
| 129 | if a == b then | ||
| 130 | return false | ||
| 131 | end | ||
| 129 | return vers.parse_version(a) > vers.parse_version(b) | 132 | return vers.parse_version(a) > vers.parse_version(b) |
| 130 | end | 133 | end |
| 131 | 134 | ||
