rem: inline unsigned char *run_priority_switch( struct cpl_interpreter *intr )
add: static inline char *run_priority_switch( struct cpl_interpreter *intr )
context: inline unsigned char *run_priority_switch( struct cpl_interpreter *intr ){	static str default_val={"normal",6};	unsigned short n;	unsigned char *p;	unsigned char *kid;	unsigned char *not_present_node;	unsigned char attr_name;	unsigned char attr_val;	unsigned char msg_attr_val;	unsigned char msg_prio;	int i;	str cpl_val = {0,0};	str msg_val = {0,0};	not_present_node = 0;	msg_attr_val = NORMAL_VAL;	for( i=0 ; i<NR_OF_KIDS(intr->ip) ; i++ ) {		kid = intr->ip + KID_OFFSET(intr->ip,i);		check_overflow_by_ptr( kid+SIMPLE_NODE_SIZE(kid), intr, script_error);		switch ( NODE_TYPE(kid) ) {			case NOT_PRESENT_NODE:				if (not_present_node) {					LOG(L_ERR,"ERROR:run_priority_switch: NOT_PRESENT node "						"found twice!\n");					goto script_error;				}				not_present_node = kid;				break;			case OTHERWISE_NODE :				if (i!=NR_OF_KIDS(intr->ip)-1) {					LOG(L_ERR,"ERROR:run_priority_switch: OTHERWISE node "						"not found as the last sub-node!\n");					goto script_error;				}				DBG("DEBUG:run_priority_switch: matching on OTHERWISE node\n");				return get_first_child(kid);			case PRIORITY_NODE :				if (NR_OF_ATTR(kid)!=1)					goto script_error;				/* get the attribute */				p = ATTR_PTR(kid);				get_basic_attr( p, attr_name, attr_val, intr, script_error);				if (attr_name!=LESS_ATTR && attr_name!=GREATER_ATTR &&				attr_name!=EQUAL_ATTR){					LOG(L_ERR,"ERROR:run_priority_switch: unknown attribut "						"(%d) in PRIORITY node\n",attr_name);					goto script_error;				}				/* attribute's encoded value */				if (attr_val!=EMERGENCY_VAL && attr_val!=URGENT_VAL &&				attr_val!=NORMAL_VAL && attr_val!=NON_URGENT_VAL &&				attr_val!=UNKNOWN_PRIO_VAL) {					LOG(L_ERR,"ERROR:run_priority_switch: unknown encoded "						"value (%d) for attribute (*d) in PRIORITY node\n",*p);					goto script_error;				}				if (attr_val==UNKNOWN_PRIO_VAL) {					if (attr_name!=EQUAL_ATTR) {						LOG(L_ERR,"ERROR:cpl_c:run_priority_switch:bad PRIORITY"							" branch: attr=EQUAL doesn't match val=UNKNOWN\n");						goto script_error;					}					/* if the attr is UNKNOWN, its string value is present  */					get_basic_attr(p, n,cpl_val.len, intr, script_error);					if (n!=PRIOSTR_ATTR) {						LOG(L_ERR,"ERROR:run_priority_switch: expected PRIOSTR"							"(%d) attr, found (%d)\n",PRIOSTR_ATTR,n);						goto script_error;					}					get_str_attr(p, cpl_val.s, cpl_val.len,intr,script_error,1);				}				DBG("DEBUG:run_priority_switch: testing PRIORITY branch "					"(attr=%d,val=%d) [%.*s](%d)..\n",					attr_name,attr_val,cpl_val.len,cpl_val.s,cpl_val.len);				if (!msg_val.s) {					if (!intr->priority) {						/* get the PRIORITY header from message */						if (!intr->msg->priority) {							if (parse_headers(intr->msg,HDR_PRIORITY,0)==-1) {								LOG(L_ERR,"ERROR:run_priority_switch: bad "									"sip msg or PRIORITY header !\n");								goto runtime_error;							} else if (!intr->msg->priority) {								LOG(L_NOTICE,"NOTICE:run_priority_switch: "									"missing PRIORITY header -> using "									"default value \"normal\"!\n");								intr->priority = &default_val;							} else {								intr->priority =									&(intr->msg->priority->body);							}						} else {							intr->priority =								&(intr->msg->priority->body);						}					}					trim_len( msg_val.len, msg_val.s, *(intr->priority));					/* encode attribute's value from SIP message */					if ( msg_val.len==EMERGENCY_STR_LEN &&					!strncasecmp(msg_val.s,EMERGENCY_STR,msg_val.len) ) {						msg_attr_val = EMERGENCY_VAL;					} else if ( msg_val.len==URGENT_STR_LEN &&					!strncasecmp(msg_val.s,URGENT_STR,msg_val.len) ) {						msg_attr_val = URGENT_VAL;					} else if ( msg_val.len==NORMAL_STR_LEN &&					!strncasecmp(msg_val.s,NORMAL_STR,msg_val.len) ) {						msg_attr_val = NORMAL_VAL;					} else if ( msg_val.len==NON_URGENT_STR_LEN &&					!strncasecmp(msg_val.s,NON_URGENT_STR,msg_val.len) ) {						msg_attr_val = NON_URGENT_VAL;					} else {						msg_attr_val = UNKNOWN_PRIO_VAL;					}					DBG("DEBUG:run_priority_switch: extracted msg priority is "						"<%.*s> decoded as [%d]\n",						msg_val.len,msg_val.s,msg_attr_val);				}				DBG("DEBUG:run_priority_switch: using msg string <%.*s>\n",					msg_val.len, msg_val.s);				/* attr_val (from cpl) cannot be UNKNOWN - we already				 * check it -> check only for msg_attr_val for non-EQUAL op */				if (msg_attr_val==UNKNOWN_PRIO_VAL && attr_name!=EQUAL_ATTR) {					LOG(L_NOTICE,"NOTICE:run_priority_switch: UNKNOWN "						"value found in sip_msg when tring a LESS/GREATER "						"cmp -> force the value to default \"normal\"\n");					msg_prio = NORMAL_VAL;				} else {					msg_prio = msg_attr_val;				}				/* does the value from script match the one from message? */				switch (attr_name) {					case LESS_ATTR:						switch (attr_val) {							case EMERGENCY_VAL:								if (msg_prio!=EMERGENCY_VAL) break; /*OK*/								else continue; /* for cycle for all kids */							case URGENT_VAL:								if (msg_prio!=EMERGENCY_VAL &&									msg_prio!=URGENT_VAL) break; /* OK */								else continue; /* for cycle for all kids */							case NORMAL_VAL:								if (msg_prio==NON_URGENT_VAL) break; /*OK*/								else continue; /* for cycle for all kids */							case NON_URGENT_VAL:								continue; /* for cycle for all kids */						}						break;					case GREATER_ATTR:						switch (attr_val) {							case EMERGENCY_VAL:								continue; /* for cycle for all kids */							case URGENT_VAL:								if (msg_prio!=EMERGENCY_VAL) break; /*OK*/								else continue; /* for cycle for all kids */							case NORMAL_VAL:								if (msg_prio!=NON_URGENT_VAL &&									msg_prio!=NORMAL_VAL) break; /*OK*/								else continue; /* for cycle for all kids */							case NON_URGENT_VAL:								if (msg_prio!=NON_URGENT_VAL) break; /*OK*/								else continue; /* for cycle for all kids */						}						break;					case EQUAL_ATTR:						if ( attr_val==msg_prio ) {							if (attr_val==UNKNOWN_PRIO_VAL) {								if ( msg_val.len==cpl_val.len &&								!strncasecmp(msg_val.s,cpl_val.s,msg_val.len)){									break; /* OK */								}							} else {								break; /* OK */							}						}						continue; /* for cycle for all kids */						break;				} /* end switch for attr_name */				DBG("DEBUG:run_priority_switch: matching current "					"PRIORITY node\n");				return get_first_child(kid);				break;			default:				LOG(L_ERR,"ERROR:run_priority_switch: unknown output node type"					" (%d) for PRIORITY_SWITCH node\n",NODE_TYPE(kid));				goto script_error;		} /* end switch for NODE_TYPE */	} /* end for for all kids */	/* none of the branches of PRIORITY_SWITCH mached -> go for default */	return DEFAULT_ACTION;runtime_error:	return CPL_RUNTIME_ERROR;script_error:	return CPL_SCRIPT_ERROR;}