} flags;
// Log file
- struct pakfire_log_file* log_file;
+ pakfire_log_file* log_file;
const char* log_path;
// Makefiles
// Logging
struct {
// File
- struct pakfire_log_file* file;
+ pakfire_log_file* file;
// Buffer
pakfire_log_buffer* buffer;
FILE* f;
};
-static void pakfire_log_file_free(struct pakfire_log_file* self) {
+static void pakfire_log_file_free(pakfire_log_file* self) {
// Close the log file
pakfire_log_file_close(self);
free(self);
}
-int pakfire_log_file_create(struct pakfire_log_file** file, pakfire_ctx* ctx,
+int pakfire_log_file_create(pakfire_log_file** file, pakfire_ctx* ctx,
const char* path, const char* filename, int flags) {
- struct pakfire_log_file* self = NULL;
+ pakfire_log_file* self = NULL;
int r;
// Allocate some memory
return r;
}
-struct pakfire_log_file* pakfire_log_file_ref(struct pakfire_log_file* self) {
+pakfire_log_file* pakfire_log_file_ref(pakfire_log_file* self) {
self->nrefs++;
return self;
}
-struct pakfire_log_file* pakfire_log_file_unref(struct pakfire_log_file* self) {
+pakfire_log_file* pakfire_log_file_unref(pakfire_log_file* self) {
if (--self->nrefs > 0)
return self;
return NULL;
}
-const char* pakfire_log_file_filename(struct pakfire_log_file* self) {
+const char* pakfire_log_file_filename(pakfire_log_file* self) {
return self->filename;
}
-const char* pakfire_log_file_path(struct pakfire_log_file* self) {
+const char* pakfire_log_file_path(pakfire_log_file* self) {
return self->path;
}
-int pakfire_log_file_close(struct pakfire_log_file* self) {
+int pakfire_log_file_close(pakfire_log_file* self) {
int r;
if (self->f) {
return 0;
}
-int pakfire_log_file_write(struct pakfire_log_file* self, int priority, const char* buffer, ssize_t length) {
+int pakfire_log_file_write(pakfire_log_file* self, int priority, const char* buffer, ssize_t length) {
int r;
// Check inputs
Writes the log into a compressed file
*/
-struct pakfire_log_file;
+typedef struct pakfire_log_file pakfire_log_file;
enum pakfire_log_file_flags {
PAKFIRE_LOG_FILE_COMPRESS = (1 << 0),
};
-int pakfire_log_file_create(struct pakfire_log_file** file,
+int pakfire_log_file_create(pakfire_log_file** file,
pakfire_ctx* ctx, const char* path, const char* filename, int flags);
-struct pakfire_log_file* pakfire_log_file_ref(struct pakfire_log_file* self);
-struct pakfire_log_file* pakfire_log_file_unref(struct pakfire_log_file* self);
+pakfire_log_file* pakfire_log_file_ref(pakfire_log_file* self);
+pakfire_log_file* pakfire_log_file_unref(pakfire_log_file* self);
-const char* pakfire_log_file_filename(struct pakfire_log_file* self);
-const char* pakfire_log_file_path(struct pakfire_log_file* self);
+const char* pakfire_log_file_filename(pakfire_log_file* self);
+const char* pakfire_log_file_path(pakfire_log_file* self);
-int pakfire_log_file_close(struct pakfire_log_file* self);
+int pakfire_log_file_close(pakfire_log_file* self);
-int pakfire_log_file_write(struct pakfire_log_file* self,
+int pakfire_log_file_write(pakfire_log_file* self,
int priority, const char* buffer, ssize_t length);
#endif /* PAKFIRE_LOG_FILE_H */
#include "../testsuite.h"
static int __test_simple(const struct test* t, int flags) {
- struct pakfire_log_file* file = NULL;
+ pakfire_log_file* file = NULL;
char path[PATH_MAX] = "";
int r = EXIT_FAILURE;