lib/dgr.c
/** Unserializes serialized data and stores it in our global dgr_list
 * variable. We do not blow away the list, instead we just update the
 * data that is already in the list.
 *
 * @param size Length of the serialized data.
 * @param serialized The serialized data as an array of bytes.
 **/
Unserializes serialized data and stores it in our global dgr_list
variable. We do not blow away the list, instead we just update the
data that is already in the list.

@param size Length of the serialized data.
@param serialized The serialized data as an array of bytes.
Unserializes serialized data and stores it in our global dgr_list variable . We do not blow away the list instead we just update the data that is already in the list . @param size Length of the serialized data . @param serialized The serialized data as an array of bytes .
static void dgr_unserialize(int size, const char *serialized)
{
	const char *ptr = serialized;
	while(ptr < serialized + size)
	{
		int c = 0;
		char name[1024];
		while(*ptr != 0)
		{
			name[c++] = *ptr;
			ptr++;
		}
		name[c++] = '\0';
		ptr++;
		int size = 0;
		memcpy(&size, ptr, sizeof(int));
		ptr += sizeof(int);
		dgr_set(name, ptr, size);
		ptr += size;
	}
}
static void dgr_unserialize ( int size , const char * serialized ) { const char * ptr = serialized ; while ( ptr < serialized + size ) { int c = 0 ; char name [ 1024 ] ; while ( * ptr != 0 ) { name [ c ++ ] = * ptr ; ptr ++ ; } name [ c ++ ] = ' \0 ' ; ptr ++ ; int size = 0 ; memcpy ( & size , ptr , sizeof ( int ) ) ; ptr += sizeof ( int ) ; dgr_set ( name , ptr , size ) ; ptr += size ; } }
Unserializes serialized data and stores it in our global dgr_list
 variable.
Unserializes serialized data and stores it in our global dgr_list variable .
//msg(MSG_DEBUG, "DGR unserialized: %s\n", name);