Changeset

8907:b7b960d30eef

Backed out changeset eae606b9266c: Used a lot of memory
author Kim Alvefur <zash@zash.se>
date Sun, 10 Jun 2018 17:37:06 +0200
parents 8905:65d1a80d3565
children 8908:144666d0ad2f
files net/dns.lua
diffstat 1 files changed, 4 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/net/dns.lua	Sun Jun 10 00:14:34 2018 +0200
+++ b/net/dns.lua	Sun Jun 10 17:37:06 2018 +0200
@@ -86,10 +86,9 @@
 end
 
 
-local function augment (t, prefix)  -- - - - - - - - - - - - - - - - -  augment
+local function augment (t)    -- - - - - - - - - - - - - - - - - - - -  augment
 	local a = {};
-	for i = 1, 0xffff do
-		local s = t[i] or ("%s%d"):format(prefix, i);
+	for i,s in pairs(t) do
 		a[i] = s;
 		a[s] = s;
 		a[string.lower(s)] = s;
@@ -120,8 +119,8 @@
 dns.classes = { 'IN', 'CS', 'CH', 'HS', [255] = '*' };
 
 
-dns.type      = augment (dns.types, "TYPE");
-dns.class     = augment (dns.classes, "CLASS");
+dns.type      = augment (dns.types);
+dns.class     = augment (dns.classes);
 dns.typecode  = encode  (dns.types);
 dns.classcode = encode  (dns.classes);