Subversion Repositories Kolibri OS

Rev

Rev 7043 | Rev 7286 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 7043 Rev 7049
Line 11... Line 11...
11
struct collection
11
struct collection
12
{
12
{
13
	int realloc_size, count;
13
	int realloc_size, count;
14
	dword data_start;
14
	dword data_start;
15
	dword data_size;
15
	dword data_size;
16
	dword element_offset[4090];
16
	dword element_offset[4000];
17
	int add();
17
	int add();
-
 
18
	int addn();
18
	dword get();
19
	dword get();
19
	void drop();
20
	void drop();
20
	void increase_data_size();
21
	void increase_data_size();
21
};
22
};
Line 32... Line 33...
32
		data_start = realloc(data_start, data_size);
33
		data_start = realloc(data_start, data_size);
33
	}
34
	}
34
}
35
}
Line 35... Line 36...
35
 
36
 
-
 
37
int collection::add(dword in) {
-
 
38
	return addn(in, strlen(in));
-
 
39
}
-
 
40
 
36
int collection::add(dword in) {
41
int collection::addn(dword in, len) {
37
	if (count >= 4090) return 0;
42
	if (count >= 4000) return 0;
38
	if (element_offset[count]+strlen(in)+2 > data_size) {
43
	if (element_offset[count]+len+2 > data_size) {
39
		increase_data_size();
44
		increase_data_size();
40
		add(in);
45
		addn(in, len);
41
		return;
46
		return 1;
42
	}
47
	}
43
	strcpy(data_start+element_offset[count], in);
48
	strncpy(data_start+element_offset[count], in, len);
44
	count++;
49
	count++;
45
	element_offset[count] = element_offset[count-1] + strlen(in) + 1;
50
	element_offset[count] = element_offset[count-1] + len + 1;
46
	return 1;
51
	return 1;
Line 47... Line 52...
47
}
52
}
48
 
53