FreeBSD/contrib/ofed/libsdp/src/config_parser.c
/* use the above state for making a new rule */
use the above state for making a new rule
use the above state for making a new rule
static void __sdp_add_rule() {
  struct use_family_rule **p_tail, **p_head, *rule;
  if (__sdp_min_level <= 1) __sdp_dump_config_state();
  if ( current_role == 1 ) {
    p_tail = &__sdp_servers_family_rules_tail;
    p_head = &__sdp_servers_family_rules_head;
  } else if ( current_role == 2 ) {
    p_tail = &__sdp_clients_family_rules_tail;
    p_head = &__sdp_clients_family_rules_head;
  } else {
    yyerror("ignoring unknown role");
    parse_err = 1;
    return;
  }
  rule = (struct use_family_rule *)malloc(sizeof(*rule));
  if (!rule) {
    yyerror("fail to allocate new rule");
    parse_err = 1;
    return;
  }
  memset(rule, 0, sizeof(*rule));
  *rule = __sdp_rule;
  rule->prev = *p_tail;
  if (!(*p_head)) {
    *p_head = rule;
  } else {
    (*p_tail)->next = rule;
  } 
  *p_tail = rule;
}
static void __sdp_add_rule ( ) { struct use_family_rule * * p_tail , * * p_head , * rule ; if ( __sdp_min_level <= 1 ) __sdp_dump_config_state ( ) ; if ( current_role == 1 ) { p_tail = & __sdp_servers_family_rules_tail ; p_head = & __sdp_servers_family_rules_head ; } else if ( current_role == 2 ) { p_tail = & __sdp_clients_family_rules_tail ; p_head = & __sdp_clients_family_rules_head ; } else { yyerror ( " " ) ; parse_err = 1 ; return ; } rule = ( struct use_family_rule * ) malloc ( sizeof ( * rule ) ) ; if ( ! rule ) { yyerror ( " " ) ; parse_err = 1 ; return ; } memset ( rule , 0 , sizeof ( * rule ) ) ; * rule = __sdp_rule ; rule -> prev = * p_tail ; if ( ! ( * p_head ) ) { * p_head = rule ; } else { ( * p_tail ) -> next = rule ; } * p_tail = rule ; }
use the above state for making a new rule
use the above state for making a new rule
/* if */