Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Per Cederqvist
lyskom-server-ceder-1616-generations-topgit
Commits
560a74da
Commit
560a74da
authored
Apr 18, 2010
by
Per Cederqvist
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
patch refactor-cached_get_text.patch
parent
de22d96e
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
14 deletions
+22
-14
.topdeps
.topdeps
+1
-1
.topmsg
.topmsg
+1
-1
src/server/dbck-cache.c
src/server/dbck-cache.c
+18
-10
src/server/simple-cache.c
src/server/simple-cache.c
+2
-2
No files found.
.topdeps
View file @
560a74da
add-text_store
introduce-generation_position
.topmsg
View file @
560a74da
From: Per Cederqvist <ceder@lysator.liu.se>
Subject: patch
introduce-generation_position
.patch
Subject: patch
refactor-cached_get_text
.patch
src/server/dbck-cache.c
View file @
560a74da
...
...
@@ -56,6 +56,8 @@
#ifdef TIME_SYNC
# include <sys/resource.h>
#endif
#include <string.h>
#include <errno.h>
#include "ldifftime.h"
#include "exp.h"
...
...
@@ -323,23 +325,29 @@ extern String
cached_get_text
(
Text_no
text
)
{
String
the_string
;
Text_stat
*
t_stat
;
TEXT_RANGE
(
"cached_get_text
\n
"
,
text
,
EMPTY_STRING
);
TRACE2
(
"cached_get_text %lu
\n
"
,
text
);
if
(
text_arr
[
text
]
==
NULL
)
if
(
(
t_stat
=
cached_get_text_stat
(
text
))
==
NULL
)
return
EMPTY_STRING
;
else
if
(
text_arr
[
text
]
->
text_store
.
generation
==
0
)
else
if
(
t_stat
->
text_store
.
generation
==
0
)
{
the_string
.
string
=
tmp_alloc
(
t_stat
->
no_of_chars
);
the_string
.
len
=
t_stat
->
no_of_chars
;
if
(
fseek
(
text_file
,
t_stat
->
text_store
.
file_pos
,
SEEK_SET
)
!=
0
)
{
the_string
.
string
=
tmp_alloc
(
text_arr
[
text
]
->
no_of_chars
);
the_string
.
len
=
text_arr
[
text
]
->
no_of_chars
;
fseek
(
text_file
,
text_arr
[
text
]
->
text_store
.
file_pos
,
SEEK_SET
);
kom_log
(
"Failed to seek to %ld in text mass file: %s.
\n
"
,
t_stat
->
text_store
.
file_pos
,
strerror
(
errno
));
return
EMPTY_STRING
;
}
if
(
fread
(
the_string
.
string
,
sizeof
(
char
),
the_string
.
len
,
text_file
)
!=
(
size_t
)
the_string
.
len
)
{
kom_log
(
"
%s read enough characters
o
f
text %lu
\n
"
,
"WARNING: cached_get_text: couldn't"
,
(
unsigned
long
)
text
)
;
kom_log
(
"
WARNING: cached_get_text: premature end
o
n
text %lu
\n
"
,
text
);
return
EMPTY_STRING
;
}
return
the_string
;
...
...
@@ -347,7 +355,7 @@ cached_get_text( Text_no text )
else
{
#warning Generation > 0 not yet handled
re
turn
EMPTY_STRING
;
re
start_kom
(
"Only generation 0 is handled.
\n
"
)
;
}
}
...
...
src/server/simple-cache.c
View file @
560a74da
...
...
@@ -1048,13 +1048,13 @@ cached_get_text( Text_no text )
String
the_string
;
Text_stat
*
t_stat
;
LOGACC
(
lt_text_mass
,
text
);
TRACE2
(
"cached_get_text %lu
\n
"
,
text
);
if
(
(
t_stat
=
cached_get_text_stat
(
text
))
==
NULL
)
return
EMPTY_STRING
;
else
if
(
t_stat
->
text_store
.
generation
==
0
)
{
LOGACC
(
lt_text_mass
,
text
);
the_string
.
string
=
tmp_alloc
(
t_stat
->
no_of_chars
);
the_string
.
len
=
t_stat
->
no_of_chars
;
if
(
fseek
(
text_file
,
t_stat
->
text_store
.
file_pos
,
SEEK_SET
)
!=
0
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment