move loop to function
This commit is contained in:
		
							parent
							
								
									3cad559617
								
							
						
					
					
						commit
						6539f8a153
					
				@ -74,18 +74,17 @@ function parseBody(current, lines) {
 | 
			
		||||
 | 
			
		||||
function parseCertData(lines) {
 | 
			
		||||
  var certs = []
 | 
			
		||||
    , line
 | 
			
		||||
    , current
 | 
			
		||||
    , skipped = 0
 | 
			
		||||
    , match
 | 
			
		||||
    , finished
 | 
			
		||||
    ;
 | 
			
		||||
 | 
			
		||||
  while (lines.length > 0) {
 | 
			
		||||
    line = lines.shift();
 | 
			
		||||
 | 
			
		||||
  function parseLine(line) {
 | 
			
		||||
    // nuke whitespace and comments
 | 
			
		||||
    if (line.match(/^#|^\s*$/)) continue;
 | 
			
		||||
    if (line.match(/^#|^\s*$/)) {
 | 
			
		||||
      return;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (line.match(/^CKA_CLASS CK_OBJECT_CLASS CKO_CERTIFICATE/)) {
 | 
			
		||||
      current = new Certificate();
 | 
			
		||||
@ -110,6 +109,10 @@ function parseCertData(lines) {
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  while (lines.length > 0) {
 | 
			
		||||
    parseLine(lines.shift());
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  console.info("Skipped %s untrusted certificates.", skipped);
 | 
			
		||||
  console.info("Processed %s certificates.", certs.length);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user