about summary refs log tree commit diff stats
path: root/src/css
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2023-10-25 12:35:11 +0200
committerbptato <nincsnevem662@gmail.com>2023-10-25 12:48:30 +0200
commit3f0a183d48a44cbbe642842fb60b69cca9e83390 (patch)
tree0aad7dfeaa3a9265e030b2ed2739de4e042a69a2 /src/css
parentb6e5390ec286747ce6789f9cfec54dec8dc18fa3 (diff)
downloadchawan-3f0a183d48a44cbbe642842fb60b69cca9e83390.tar.gz
reduce new() usage
Diffstat (limited to 'src/css')
-rw-r--r--src/css/sheet.nim9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/css/sheet.nim b/src/css/sheet.nim
index 1f68816a..d3cd011f 100644
--- a/src/css/sheet.nim
+++ b/src/css/sheet.nim
@@ -34,11 +34,12 @@ type SelectorHashes = object
   class: string
 
 func newStylesheet*(cap: int): CSSStylesheet =
-  new(result)
   let bucketsize = cap div 2
-  result.id_table = initTable[string, seq[CSSRuleDef]](bucketsize)
-  result.class_table = initTable[string, seq[CSSRuleDef]](bucketsize)
-  result.general_list = newSeqOfCap[CSSRuleDef](bucketsize)
+  return CSSStylesheet(
+    id_table: initTable[string, seq[CSSRuleDef]](bucketsize),
+    class_table: initTable[string, seq[CSSRuleDef]](bucketsize),
+    general_list: newSeqOfCap[CSSRuleDef](bucketsize)
+  )
 
 proc getSelectorIds(hashes: var SelectorHashes, sel: Selector): bool