add: if ((strncmp(tmp.field_value[1], "GLOBAL\001fu\001", 10) == 0) && (strncmp(tmp.field_value[5], "gv\001", 3) == 0)) { char * field, *end; char * varname; LongString var_key, data_key; int result;  end = field = tmp.field_value[4]; while (*end != '\1') { end++; } *end = '\0'; varname = SN_StrDup(field); *end = '\1';    LongStringInit(&var_key,0); LongStringInit(&data_key,0);  var_key.copystrings(&var_key, varname, DB_FLDSEP_STR, "000000.000", DB_FLDSEP_STR, "GLOBAL", NULL); data_key.copystrings(&data_key, "0.0", DB_FLDSEP_STR, "0x0", DB_FLDSEP_STR, "{}", DB_FLDSEP_STR, "{}", DB_FLDSEP_STR, "{}", DB_FLDSEP_STR, "{}", NULL);  if (!db_key_in_table(PAF_GLOB_VAR_DEF, var_key.buf)) {   db_insert_entry(PAF_GLOB_VAR_DEF, var_key.buf, data_key.buf);  var_key.free(&var_key); data_key.free(&data_key);  LongStringInit(&var_key,0); LongStringInit(&data_key,0);  var_key.copystrings(&var_key, "GLOBAL", DB_FLDSEP_STR, "000000.000", DB_FLDSEP_STR, "#", DB_FLDSEP_STR, varname, DB_FLDSEP_STR, "gv", NULL); data_key.copystrings(&data_key, "0.0", DB_FLDSEP_STR, "0.0", DB_FLDSEP_STR, "0.0", DB_FLDSEP_STR, "{}", NULL);  db_insert_entry(PAF_FILE_SYMBOLS, var_key.buf, data_key.buf); }  var_key.free(&var_key); data_key.free(&data_key); ckfree((char*) varname); }
context: db_insert_entry(int type,char *key_buf,char *data_buf){	register unsigned char *p;	DB      *dbp = db_syms[type];	DBT     data;	DBT     key;	LongString tmp;	LongString xref_data;	LongString xref;	LongString xref_data_fields;	if (type == PAF_FILE)	{		char    group[80];		char    highfile[MAXPATHLEN];		int		state;		group[0] = '\0';		highfile[0] = '\0';		/*		 * read group and highlight file */		read_next_field (data_buf, group, 80, DB_FLDSEP_CHR);		read_next_field (NULL, highfile, MAXPATHLEN, DB_FLDSEP_CHR);		if (highfile[0])			p = (unsigned char *)highfile;		else			p = NULL;		state = put_file_db(key_buf,group,p);		if (state == 0)		{			db_remove_file_def(0,key_buf);		}		return;	}	if (!dbp)	{		int csize;		if (type == PAF_CROSS_REF)		{			csize = db_cross_cachesize;		}		else		{			csize = db_cachesize;		}		dbp = create_table(type,O_RDWR|O_CREAT,csize);		/* Open the table ! */		if (!dbp)			return;	}	if (type != PAF_CROSS_REF)	{		key.data = key_buf;		key.size = strlen(key.data) + 1;		data.data = data_buf;		for (p = (unsigned char *)data.data; *p; p++)		{			if (*p == 0xff)				*p = '\n';		}		data.size = (char *)p - (char *)data.data + 1;		if(dbp->put(dbp,&key,&data,0) == -1)		{			Paf_panic(PAF_PANIC_EMERGENCY);		}		return;	}	LongStringInit(&xref,0);	LongStringInit(&xref_data,0);	LongStringInit(&xref_data_fields,0);	LongStringInit(&tmp,0);	xref_data_fields.split (&xref_data_fields,		data_buf,		-1,		FALSE,		DB_FLDSEP_CHR,		-1);	xref_data.copy(&xref_data,		"{", -1);	xref_data.append (&xref_data,		xref_data_fields.field_value[0],		xref_data_fields.field_size[0]);	xref_data.appendstrings(&xref_data, "}", DB_FLDSEP_STR, "{", NULL);	xref_data.append (&xref_data,		xref_data_fields.field_value[1],		xref_data_fields.field_size[1]);	xref_data.append (&xref_data, "}", -1);	data.data = (void *)xref_data.buf;	data.size = xref_data.len + 1;	/* If a parser could not figure out a scope of a member because	 * for example an inherited class was not known, we can fix it	 * here.	 */	if (*key_buf == '?')	{		static int opened = FALSE;		char arg_types[10000] = {0};		char ret_type [1024] = {0};		char this_cls [1024] = {0};		char name     [1024] = {0};		char scope_buf[1024] = {0};		if (!opened)		{			open_tables_for_cross_ref();			opened = TRUE;		}		MY_DEBUG((Output, "%s\n", key_buf));		/*		 * skip field		 */		read_next_field (key_buf, NULL, 0, DB_FLDSEP_CHR);		/*		 * Name */		read_next_field (NULL, name, sizeof(name), DB_FLDSEP_CHR);		/*		 * Skip field */		read_next_field (NULL, NULL, 0, DB_FLDSEP_CHR);		/*		 * Class */		read_next_field (NULL, this_cls, sizeof (this_cls), DB_FLDSEP_CHR);		get_symbol (this_cls,			NULL,			name,			arg_types,			scope_buf,			ret_type,			NULL,			1);		/* switch "?" with the returned class name */		if (*scope_buf != '\0' && *scope_buf != '?')		{			int len = strlen(scope_buf);			memmove (key_buf+len-1, key_buf, strlen (key_buf) - len);			memcpy(key_buf, scope_buf, len);		}		MY_DEBUG2 ((Output, "split key <%s>\n", key_buf));		/* Format:		 * Class Method Type DeclClass Var VarType Line File		 * Example:RectShape draw mi ? chr1 iv 000003 RectShape.java		 */		tmp.split(&tmp, key_buf, key.size, FALSE, DB_FLDSEP_CHR, 7);		tmp.append(&tmp,			tmp.field_value[3],			tmp.field_size[3] + tmp.field_size[4] + tmp.field_size[5] + 3);		tmp.append(&tmp,			tmp.field_value[0],			tmp.field_size[0] + 1);		tmp.append(&tmp,			tmp.field_value[1],			tmp.field_size[1] + tmp.field_size[2] + 2);		tmp.append(&tmp,			tmp.field_value[6],			tmp.field_size[6]);		key.data = tmp.buf;		key.size = tmp.len + 1;	}	else	{		key.data = key_buf;		key.size = strlen(key.data) + 1;	}	if(dbp->put(dbp,&key,&data,0) == -1)	{		Paf_panic(PAF_PANIC_EMERGENCY);	}	MY_DEBUG2 ((Output, "split data <%s>\n", key.data));	tmp.split (&tmp,key.data, key.size -1, FALSE, DB_FLDSEP_CHR, -1);	if (tmp.field_value[5][0] != SN_GetSymbolType(PAF_REF_TO_LOCAL_VAR)[0] ||		tmp.field_value[5][1] != SN_GetSymbolType(PAF_REF_TO_LOCAL_VAR)[1])	{		dbp = db_syms[PAF_CROSS_REF_BY];		if (!dbp)		{			dbp = create_table(PAF_CROSS_REF_BY,O_RDWR|O_CREAT,				db_cross_cachesize);		/* Open the table ! */			if (!dbp)			{				xref_data.free(&xref_data);				xref.free(&xref);				tmp.free(&tmp);				return;			}		}		xref.copy(&xref,			tmp.field_value[3],			tmp.field_size[3] + tmp.field_size[4] + tmp.field_size[5] + 3);		xref.append(&xref,			tmp.field_value[0],			tmp.field_size[0] + tmp.field_size[1] + tmp.field_size[2] + 3);		xref.append(&xref,			tmp.field_value[6],			tmp.field_size[6] + tmp.field_size[7] + tmp.field_size[8] + 2);		key.data = (void *)xref.buf;		key.size = xref.len + 1;		xref_data.copy(&xref_data,			"{", -1);		xref_data.append(&xref_data,			xref_data_fields.field_value[1],			xref_data_fields.field_size[1]);		xref_data.appendstrings (&xref_data, "}", DB_FLDSEP_STR, "{", NULL);		xref_data.append(&xref_data,			xref_data_fields.field_value[0],			xref_data_fields.field_size[0]);		xref_data.append(&xref_data, "}", -1);		data.data = (void *)xref_data.buf;		data.size = xref_data.len + 1;		if(dbp->put(dbp,&key,&data,0) == -1)		{			Paf_panic(PAF_PANIC_EMERGENCY);		}	}	xref_data_fields.free(&xref_data_fields);	xref_data.free(&xref_data);	xref.free(&xref);	tmp.free(&tmp);}