static struct data_pair * find_pair_by_key(char * key){
    struct data_pair * p;
    for( p=head; p!=NULL; p=p->next ) 
    {
        if(pd_strcmp(key, p->key) == 0){
            return p;
        }
    }
    return NULL;
}
Example #2
0
int pd_string_compare(t_pdstring *s1, t_pdstring *s2)
{
	if (s1 && s2) {
		if (s1 == s2) {
			return 0;		// identical => equal
		}
		pduint32 i, len = s1->length;
		const pduint8* p1 = s1->strData;
		const pduint8* p2 = s2->strData;
		if (len != s2->length) {
			// shorter string is 'less'
			return (len < s2->length) ? -1 : 1;
		}
		for (i = 0; i < len; i++) {
			if (p1[i] != p2[i]) {
				return (p1[i] < p2[i]) ? -1 : 1;
			}
		}
		return 0;			// equal
	}
	else {
		return pd_strcmp(NULL, NULL);
	}
}