Browse Source

Attribute containing the total length of a contact added

Jan Janak 21 years ago
parent
commit
d6fcabe805
2 changed files with 4 additions and 0 deletions
  1. 3 0
      parser/contact/contact.c
  2. 1 0
      parser/contact/contact.h

+ 3 - 0
parser/contact/contact.c

@@ -252,6 +252,7 @@ int parse_contacts(str* _s, contact_t** _c)
 		}
 
 		     /* Next character is comma */
+		c->len = _s->s - c->name.s;
 		_s->s++;
 		_s->len--;
 		trim_leading(_s);
@@ -271,6 +272,7 @@ int parse_contacts(str* _s, contact_t** _c)
 	return -1;
 
  ok:
+	c->len = _s->s - c->name.s;
 	c->next = *_c;
 	*_c = c;
 	return 0;
@@ -313,6 +315,7 @@ void print_contacts(FILE* _o, contact_t* _c)
 		fprintf(_o, "expires : %p\n", ptr->expires);
 		fprintf(_o, "received: %p\n", ptr->received);
 		fprintf(_o, "method  : %p\n", ptr->method);
+		fprintf(_o, "len     : %d\n", ptr->len);
 		if (ptr->params) {
 			print_params(_o, ptr->params);
 		}

+ 1 - 0
parser/contact/contact.h

@@ -51,6 +51,7 @@ typedef struct contact {
 	param_t* method;        /* method parameter hook */
 	param_t* received;      /* received parameter hook */
 	param_t* params;        /* List of all parameters */
+	int len;                /* Total length of the element */
         struct contact* next; /* Next contact in the list */
 } contact_t;