Skip to content
This repository has been archived by the owner on Jan 21, 2019. It is now read-only.

Commit

Permalink
Using 1024*1024 buffer when converting JSON to Yara
Browse files Browse the repository at this point in the history
  • Loading branch information
Xumeiquer committed Mar 29, 2017
1 parent 7451529 commit 74e7af3
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion main.funcs.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ const (
INLINE = `(?m)\s*//.*[\n\r][\n\r]?`
BLANKS = `(?m)\s+$`
QUOTES = `"`
MAXBUFF = 1024 * 1024 // If needed Go will take it form RAM.
)

func processFile(fileName string) []*yago.Parser {
Expand Down Expand Up @@ -115,8 +116,10 @@ func processInputFile(inputFile string, validJSON bool) []*yago.Parser {
checkErr(err)
defer file.Close()

var buff []byte

scanner := bufio.NewScanner(file)
// scanner.Split(splitBy)
scanner.Buffer(buff, MAXBUFF)

var rules *yago.Parser
for scanner.Scan() {
Expand Down

0 comments on commit 74e7af3

Please sign in to comment.