An unneeded line was preventing a handful of functions from being const.
Change-Id: I34f288f828505f4fd1a133efaaf3cb1f0d7656e1
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
int logfile_open(struct log_file *l_file, logfile_hook_fn open_fn);
int logfile_rotate_needed(struct log_file *l_file);
void logfile_do_rotate(struct log_file *file);
-int logfile_write_with_rotation(struct logger_entry *e, struct log_file *file);
+int logfile_write_with_rotation(const struct logger_entry *e, struct log_file *file);
#ifdef __cplusplus
}
log_priority priority;
pid_t pid;
pthread_t tid;
- char * tag;
+ const char *tag;
size_t messageLen;
- char * message;
+ const char *message;
} log_entry;
log_format *log_format_new();
* Returns 0 on success and -1 on invalid wire format (entry will be
* in unspecified state)
*/
-int log_process_log_buffer(struct logger_entry *entry_raw, log_entry *entry);
+int log_process_log_buffer(const struct logger_entry *entry_raw, log_entry *entry);
/**
* Formats a log message into a buffer
* @param[in] timeout Sort timeout in ms
* @return 1 if the log was old enough, else 0
*/
-static int process_log(struct logger_entry *e, struct timespec ts, struct log_file *l_file, long timeout)
+static int process_log(const struct logger_entry *e, struct timespec ts, struct log_file *l_file, long timeout)
{
assert(e);
assert(l_file);
* @param[in] file The file to write to
* @returns 0 if log was successfully written, else 1
*/
-int logfile_write_with_rotation(struct logger_entry *e, struct log_file *file)
+int logfile_write_with_rotation(const struct logger_entry *e, struct log_file *file)
{
log_entry entry;
if (log_process_log_buffer(e, &entry) || !log_should_print_line(file->format, &entry))
* @param[out] entry The entry to fill
* @return 0 on success, -1 on failure
*/
-int log_process_log_buffer(struct logger_entry *entry_raw, log_entry *entry)
+int log_process_log_buffer(const struct logger_entry *entry_raw, log_entry *entry)
{
//TODO: remove and make log_format_log_line just use raw entry directly
int i, start = -1, end = -1;
fprintf(stderr, "Malformed log message\n");
return -1;
}
- if (end == -1) {
+ if (end == -1)
end = entry_raw->len - 1;
- entry_raw->msg[end] = '\0';
- }
entry->message = entry_raw->msg + start;
entry->messageLen = end - start;