Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Config file parsing #1

Closed
wants to merge 4 commits into from
Closed

Config file parsing #1

wants to merge 4 commits into from

Conversation

mschiffm
Copy link
Contributor

@mschiffm mschiffm commented Mar 3, 2014

First stab at config file parsing code

@vixie
Copy link
Collaborator

vixie commented Mar 4, 2014

incorrect indentation

globals not made static

"config_file" not static

brace placement not consistent with file's prior convention

pointers are not booleans; "if (p)" should be written "if (p != NULL)"

this is wrong, in that it will result in trash if "rec" were ever
changed from a structure to a pointer, or if it was changed to a
different kind of struct:

  • memset(rec, 0, sizeof *rec);
  • memset(rec, 0, sizeof (struct dnsdb_crack));

this is bizaare, in that it only changes indentation (to make it wrong):

  • }
  • rec->obj.bailiwick = json_object_get(rec->obj.main, "bailiwick");
  • if (rec->obj.bailiwick != NULL) {
  •   if (!json_is_string(rec->obj.bailiwick)) {
    
  •       msg = "bailiwick must be a string";
    
  •       goto ouch;
    
  •   }
    
  •   rec->bailiwick = json_string_value(rec->obj.bailiwick);
    
  • }

  • /* Records. */
  • }
  • rec->obj.bailiwick = json_object_get(rec->obj.main, "bailiwick");
  • if (rec->obj.bailiwick != NULL) {
  •    if (!json_is_string(rec->obj.bailiwick)) {
    
  •        msg = "bailiwick must be a string";
    
  •        goto ouch;
    
  •    }
    
  •    rec->bailiwick = json_string_value(rec->obj.bailiwick);
    
  • }
  • /* Records. */

try again?

vixie

@mschiffm
Copy link
Contributor Author

mschiffm commented Apr 9, 2015

Will refactor and resubmit.

@mschiffm mschiffm closed this Apr 9, 2015
@vixie vixie mentioned this pull request Jul 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants