diff --git a/src/libsysprof-capture/mapped-ring-buffer.c b/src/libsysprof-capture/mapped-ring-buffer.c index a364ba8d..76d30a65 100644 --- a/src/libsysprof-capture/mapped-ring-buffer.c +++ b/src/libsysprof-capture/mapped-ring-buffer.c @@ -478,7 +478,7 @@ mapped_ring_buffer_advance (MappedRingBuffer *self, * Returns: %TRUE if the buffer was drained, %FALSE if @callback prematurely * returned while draining. */ -gboolean +bool mapped_ring_buffer_drain (MappedRingBuffer *self, MappedRingBufferCallback callback, void *user_data) @@ -499,7 +499,7 @@ mapped_ring_buffer_drain (MappedRingBuffer *self, g_assert (tailpos < self->body_size); if (headpos == tailpos) - return TRUE; + return true; /* If head needs to wrap around to get to tail, we can just rely on * our double mapping instead actually manually wrapping/copying data. @@ -515,10 +515,10 @@ mapped_ring_buffer_drain (MappedRingBuffer *self, size_t len = tailpos - headpos; if (!callback (data, &len, user_data)) - return FALSE; + return false; if (len > (tailpos - headpos)) - return FALSE; + return false; headpos += len; @@ -528,7 +528,7 @@ mapped_ring_buffer_drain (MappedRingBuffer *self, g_atomic_int_set (&header->head, headpos); } - return TRUE; + return true; } /** @@ -542,7 +542,7 @@ mapped_ring_buffer_drain (MappedRingBuffer *self, * * Returns: %TRUE if the buffer is empty, %FALSE otherwise */ -gboolean +bool mapped_ring_buffer_is_empty (MappedRingBuffer *self) { MappedRingHeader *header; diff --git a/src/libsysprof-capture/mapped-ring-buffer.h b/src/libsysprof-capture/mapped-ring-buffer.h index 15d9a00e..0607aab0 100644 --- a/src/libsysprof-capture/mapped-ring-buffer.h +++ b/src/libsysprof-capture/mapped-ring-buffer.h @@ -21,6 +21,7 @@ #pragma once #include +#include #include G_BEGIN_DECLS @@ -50,9 +51,9 @@ typedef struct _MappedRingBuffer MappedRingBuffer; * * Returns: %TRUE to coninue draining, otherwise %FALSE and draining stops */ -typedef gboolean (*MappedRingBufferCallback) (const void *data, - size_t *length, - void *user_data); +typedef bool (*MappedRingBufferCallback) (const void *data, + size_t *length, + void *user_data); G_GNUC_INTERNAL MappedRingBuffer *mapped_ring_buffer_new_reader (size_t buffer_size); @@ -75,10 +76,10 @@ G_GNUC_INTERNAL void mapped_ring_buffer_advance (MappedRingBuffer *self, size_t length); G_GNUC_INTERNAL -gboolean mapped_ring_buffer_drain (MappedRingBuffer *self, +bool mapped_ring_buffer_drain (MappedRingBuffer *self, MappedRingBufferCallback callback, void *user_data); G_GNUC_INTERNAL -gboolean mapped_ring_buffer_is_empty (MappedRingBuffer *self); +bool mapped_ring_buffer_is_empty (MappedRingBuffer *self); G_END_DECLS diff --git a/src/libsysprof-capture/sysprof-address.c b/src/libsysprof-capture/sysprof-address.c index 8d2fc06f..0ddb68ce 100644 --- a/src/libsysprof-capture/sysprof-address.c +++ b/src/libsysprof-capture/sysprof-address.c @@ -61,10 +61,11 @@ #else # include "sysprof-address-fallback.h" #endif +#include #include "sysprof-address.h" -gboolean +bool sysprof_address_is_context_switch (SysprofAddress address, SysprofAddressContext *context) { @@ -77,31 +78,31 @@ sysprof_address_is_context_switch (SysprofAddress address, { case PERF_CONTEXT_HV: *context = SYSPROF_ADDRESS_CONTEXT_HYPERVISOR; - return TRUE; + return true; case PERF_CONTEXT_KERNEL: *context = SYSPROF_ADDRESS_CONTEXT_KERNEL; - return TRUE; + return true; case PERF_CONTEXT_USER: *context = SYSPROF_ADDRESS_CONTEXT_USER; - return TRUE; + return true; case PERF_CONTEXT_GUEST: *context = SYSPROF_ADDRESS_CONTEXT_GUEST; - return TRUE; + return true; case PERF_CONTEXT_GUEST_KERNEL: *context = SYSPROF_ADDRESS_CONTEXT_GUEST_KERNEL; - return TRUE; + return true; case PERF_CONTEXT_GUEST_USER: *context = SYSPROF_ADDRESS_CONTEXT_GUEST_USER; - return TRUE; + return true; default: *context = SYSPROF_ADDRESS_CONTEXT_NONE; - return FALSE; + return false; } } diff --git a/src/libsysprof-capture/sysprof-address.h b/src/libsysprof-capture/sysprof-address.h index ece0a99e..3b5ca4e9 100644 --- a/src/libsysprof-capture/sysprof-address.h +++ b/src/libsysprof-capture/sysprof-address.h @@ -56,6 +56,7 @@ #pragma once +#include #include #include "sysprof-version-macros.h" @@ -78,7 +79,7 @@ typedef enum } SysprofAddressContext; SYSPROF_AVAILABLE_IN_ALL -gboolean sysprof_address_is_context_switch (SysprofAddress address, +bool sysprof_address_is_context_switch (SysprofAddress address, SysprofAddressContext *context); SYSPROF_AVAILABLE_IN_ALL const char *sysprof_address_context_to_string (SysprofAddressContext context); diff --git a/src/libsysprof-capture/sysprof-capture-condition.c b/src/libsysprof-capture/sysprof-capture-condition.c index aaa81262..62f12e1e 100644 --- a/src/libsysprof-capture/sysprof-capture-condition.c +++ b/src/libsysprof-capture/sysprof-capture-condition.c @@ -58,6 +58,7 @@ #include "config.h" +#include #include #include "sysprof-capture-condition.h" @@ -104,7 +105,7 @@ struct _SysprofCaptureCondition } u; }; -gboolean +bool sysprof_capture_condition_match (const SysprofCaptureCondition *self, const SysprofCaptureFrame *frame) { @@ -125,9 +126,9 @@ sysprof_capture_condition_match (const SysprofCaptureCondition *self, for (size_t i = 0; i < self->u.where_type_in->len; i++) { if (frame->type == g_array_index (self->u.where_type_in, SysprofCaptureFrameType, i)) - return TRUE; + return true; } - return FALSE; + return false; case SYSPROF_CAPTURE_CONDITION_WHERE_TIME_BETWEEN: return (frame->time >= self->u.where_time_between.begin && frame->time <= self->u.where_time_between.end); @@ -136,9 +137,9 @@ sysprof_capture_condition_match (const SysprofCaptureCondition *self, for (size_t i = 0; i < self->u.where_pid_in->len; i++) { if (frame->pid == g_array_index (self->u.where_pid_in, int32_t, i)) - return TRUE; + return true; } - return FALSE; + return false; case SYSPROF_CAPTURE_CONDITION_WHERE_COUNTER_IN: if (frame->type == SYSPROF_CAPTURE_FRAME_CTRSET) @@ -159,7 +160,7 @@ sysprof_capture_condition_match (const SysprofCaptureCondition *self, counter == set->values[j].ids[5] || counter == set->values[j].ids[6] || counter == set->values[j].ids[7]) - return TRUE; + return true; } } } @@ -174,16 +175,16 @@ sysprof_capture_condition_match (const SysprofCaptureCondition *self, for (unsigned int j = 0; j < def->n_counters; j++) { if (def->counters[j].id == counter) - return TRUE; + return true; } } } - return FALSE; + return false; case SYSPROF_CAPTURE_CONDITION_WHERE_FILE: if (frame->type != SYSPROF_CAPTURE_FRAME_FILE_CHUNK) - return FALSE; + return false; return g_strcmp0 (((const SysprofCaptureFileChunk *)frame)->path, self->u.where_file) == 0; @@ -193,7 +194,7 @@ sysprof_capture_condition_match (const SysprofCaptureCondition *self, g_assert_not_reached (); - return FALSE; + return false; } static SysprofCaptureCondition * diff --git a/src/libsysprof-capture/sysprof-capture-condition.h b/src/libsysprof-capture/sysprof-capture-condition.h index 8792449e..185df91c 100644 --- a/src/libsysprof-capture/sysprof-capture-condition.h +++ b/src/libsysprof-capture/sysprof-capture-condition.h @@ -56,6 +56,8 @@ #pragma once +#include + #include "sysprof-capture-types.h" #include "sysprof-version-macros.h" @@ -88,7 +90,7 @@ SysprofCaptureCondition *sysprof_capture_condition_new_where_counter_in (unsig SYSPROF_AVAILABLE_IN_ALL SysprofCaptureCondition *sysprof_capture_condition_new_where_file (const char *path); SYSPROF_AVAILABLE_IN_ALL -gboolean sysprof_capture_condition_match (const SysprofCaptureCondition *self, +bool sysprof_capture_condition_match (const SysprofCaptureCondition *self, const SysprofCaptureFrame *frame); G_END_DECLS diff --git a/src/libsysprof-capture/sysprof-capture-cursor.h b/src/libsysprof-capture/sysprof-capture-cursor.h index 8b2c0598..4635006a 100644 --- a/src/libsysprof-capture/sysprof-capture-cursor.h +++ b/src/libsysprof-capture/sysprof-capture-cursor.h @@ -56,6 +56,8 @@ #pragma once +#include + #include "sysprof-capture-types.h" #include "sysprof-version-macros.h" @@ -74,8 +76,8 @@ typedef struct _SysprofCaptureCursor SysprofCaptureCursor; * * Returns: %TRUE if iteration should continue, otherwise %FALSE. */ -typedef gboolean (*SysprofCaptureCursorCallback) (const SysprofCaptureFrame *frame, - void *user_data); +typedef bool (*SysprofCaptureCursorCallback) (const SysprofCaptureFrame *frame, + void *user_data); SYSPROF_AVAILABLE_IN_ALL SysprofCaptureCursor *sysprof_capture_cursor_new (SysprofCaptureReader *reader); diff --git a/src/libsysprof-capture/sysprof-capture-reader.c b/src/libsysprof-capture/sysprof-capture-reader.c index 4cf634bf..d6505149 100644 --- a/src/libsysprof-capture/sysprof-capture-reader.c +++ b/src/libsysprof-capture/sysprof-capture-reader.c @@ -87,7 +87,7 @@ struct _SysprofCaptureReader unsigned int st_buf_set : 1; }; -static gboolean +static bool sysprof_capture_reader_read_file_header (SysprofCaptureReader *self, SysprofCaptureFileHeader *header, GError **error) @@ -101,7 +101,7 @@ sysprof_capture_reader_read_file_header (SysprofCaptureReader *self, G_FILE_ERROR, g_file_error_from_errno (errno), "%s", g_strerror (errno)); - return FALSE; + return false; } if (header->magic != SYSPROF_CAPTURE_MAGIC) @@ -110,12 +110,12 @@ sysprof_capture_reader_read_file_header (SysprofCaptureReader *self, G_FILE_ERROR, G_FILE_ERROR_FAILED, "Capture file magic does not match"); - return FALSE; + return false; } header->capture_time[sizeof header->capture_time - 1] = '\0'; - return TRUE; + return true; } static void @@ -349,7 +349,7 @@ sysprof_capture_reader_bswap_jitmap (SysprofCaptureReader *self, jitmap->n_jitmaps = GUINT64_SWAP_LE_BE (jitmap->n_jitmaps); } -static gboolean +static bool sysprof_capture_reader_ensure_space_for (SysprofCaptureReader *self, size_t len) { @@ -391,7 +391,7 @@ sysprof_capture_reader_ensure_space_for (SysprofCaptureReader *self, return (self->len - self->pos) >= len; } -gboolean +bool sysprof_capture_reader_skip (SysprofCaptureReader *self) { SysprofCaptureFrame *frame; @@ -400,28 +400,28 @@ sysprof_capture_reader_skip (SysprofCaptureReader *self) g_assert ((self->pos % SYSPROF_CAPTURE_ALIGN) == 0); if (!sysprof_capture_reader_ensure_space_for (self, sizeof (SysprofCaptureFrame))) - return FALSE; + return false; frame = (SysprofCaptureFrame *)(void *)&self->buf[self->pos]; sysprof_capture_reader_bswap_frame (self, frame); if (frame->len < sizeof (SysprofCaptureFrame)) - return FALSE; + return false; if (!sysprof_capture_reader_ensure_space_for (self, frame->len)) - return FALSE; + return false; frame = (SysprofCaptureFrame *)(void *)&self->buf[self->pos]; self->pos += frame->len; if ((self->pos % SYSPROF_CAPTURE_ALIGN) != 0) - return FALSE; + return false; - return TRUE; + return true; } -gboolean +bool sysprof_capture_reader_peek_frame (SysprofCaptureReader *self, SysprofCaptureFrame *frame) { @@ -433,7 +433,7 @@ sysprof_capture_reader_peek_frame (SysprofCaptureReader *self, g_assert (self->pos <= self->bufsz); if (!sysprof_capture_reader_ensure_space_for (self, sizeof *real_frame)) - return FALSE; + return false; g_assert ((self->pos % SYSPROF_CAPTURE_ALIGN) == 0); @@ -453,7 +453,7 @@ sysprof_capture_reader_peek_frame (SysprofCaptureReader *self, return frame->type > 0 && frame->type < SYSPROF_CAPTURE_FRAME_LAST; } -gboolean +bool sysprof_capture_reader_peek_type (SysprofCaptureReader *self, SysprofCaptureFrameType *type) { @@ -463,7 +463,7 @@ sysprof_capture_reader_peek_type (SysprofCaptureReader *self, g_assert (type != NULL); if (!sysprof_capture_reader_peek_frame (self, &frame)) - return FALSE; + return false; *type = frame.type; @@ -953,7 +953,7 @@ sysprof_capture_reader_read_counter_set (SysprofCaptureReader *self) return set; } -gboolean +bool sysprof_capture_reader_reset (SysprofCaptureReader *self) { g_assert (self != NULL); @@ -962,7 +962,7 @@ sysprof_capture_reader_reset (SysprofCaptureReader *self) self->pos = 0; self->len = 0; - return TRUE; + return true; } SysprofCaptureReader * @@ -986,7 +986,7 @@ sysprof_capture_reader_unref (SysprofCaptureReader *self) sysprof_capture_reader_finalize (self); } -gboolean +bool sysprof_capture_reader_splice (SysprofCaptureReader *self, SysprofCaptureWriter *dest, GError **error) @@ -1002,7 +1002,7 @@ sysprof_capture_reader_splice (SysprofCaptureReader *self, G_FILE_ERROR, g_file_error_from_errno (errno), "%s", g_strerror (errno)); - return FALSE; + return false; } /* @@ -1025,7 +1025,7 @@ sysprof_capture_reader_splice (SysprofCaptureReader *self, * * Returns: %TRUE on success; otherwise %FALSE and @error is set. */ -gboolean +bool sysprof_capture_reader_save_as (SysprofCaptureReader *self, const char *filename, GError **error) @@ -1075,7 +1075,7 @@ sysprof_capture_reader_save_as (SysprofCaptureReader *self, close (fd); - return TRUE; + return true; handle_errno: if (fd != -1) @@ -1086,7 +1086,7 @@ handle_errno: g_file_error_from_errno (errno), "%s", g_strerror (errno)); - return FALSE; + return false; } int64_t @@ -1180,16 +1180,16 @@ sysprof_capture_reader_set_stat (SysprofCaptureReader *self, if (st_buf != NULL) { self->st_buf = *st_buf; - self->st_buf_set = TRUE; + self->st_buf_set = true; } else { memset (&self->st_buf, 0, sizeof (self->st_buf)); - self->st_buf_set = FALSE; + self->st_buf_set = false; } } -gboolean +bool sysprof_capture_reader_get_stat (SysprofCaptureReader *self, SysprofCaptureStat *st_buf) { @@ -1284,7 +1284,7 @@ sysprof_capture_reader_list_files (SysprofCaptureReader *self) return (char **)g_ptr_array_free (g_steal_pointer (&ar), FALSE); } -gboolean +bool sysprof_capture_reader_read_file_fd (SysprofCaptureReader *self, const char *path, int fd) @@ -1301,13 +1301,13 @@ sysprof_capture_reader_read_file_fd (SysprofCaptureReader *self, size_t to_write; if (!sysprof_capture_reader_peek_type (self, &type)) - return FALSE; + return false; if (type != SYSPROF_CAPTURE_FRAME_FILE_CHUNK) goto skip; if (!(file = sysprof_capture_reader_read_file (self))) - return FALSE; + return false; if (g_strcmp0 (path, file->path) != 0) goto skip; @@ -1321,10 +1321,10 @@ sysprof_capture_reader_read_file_fd (SysprofCaptureReader *self, written = _sysprof_write (fd, buf, to_write); if (written < 0) - return FALSE; + return false; if (written == 0 && errno != EAGAIN) - return FALSE; + return false; g_assert (written <= (ssize_t)to_write); @@ -1335,11 +1335,11 @@ sysprof_capture_reader_read_file_fd (SysprofCaptureReader *self, if (!file->is_last) continue; - return TRUE; + return true; skip: if (!sysprof_capture_reader_skip (self)) - return FALSE; + return false; } g_return_val_if_reached (FALSE); diff --git a/src/libsysprof-capture/sysprof-capture-reader.h b/src/libsysprof-capture/sysprof-capture-reader.h index 09348584..d4e3e7df 100644 --- a/src/libsysprof-capture/sysprof-capture-reader.h +++ b/src/libsysprof-capture/sysprof-capture-reader.h @@ -56,6 +56,8 @@ #pragma once +#include + #include "sysprof-capture-types.h" #include "sysprof-version-macros.h" @@ -86,12 +88,12 @@ int64_t sysprof_capture_reader_get_start_time ( SYSPROF_AVAILABLE_IN_ALL int64_t sysprof_capture_reader_get_end_time (SysprofCaptureReader *self); SYSPROF_AVAILABLE_IN_ALL -gboolean sysprof_capture_reader_skip (SysprofCaptureReader *self); +bool sysprof_capture_reader_skip (SysprofCaptureReader *self); SYSPROF_AVAILABLE_IN_ALL -gboolean sysprof_capture_reader_peek_type (SysprofCaptureReader *self, +bool sysprof_capture_reader_peek_type (SysprofCaptureReader *self, SysprofCaptureFrameType *type); SYSPROF_AVAILABLE_IN_ALL -gboolean sysprof_capture_reader_peek_frame (SysprofCaptureReader *self, +bool sysprof_capture_reader_peek_frame (SysprofCaptureReader *self, SysprofCaptureFrame *frame); SYSPROF_AVAILABLE_IN_ALL const SysprofCaptureLog *sysprof_capture_reader_read_log (SysprofCaptureReader *self); @@ -122,17 +124,17 @@ const SysprofCaptureFileChunk *sysprof_capture_reader_read_file ( SYSPROF_AVAILABLE_IN_3_36 const SysprofCaptureAllocation *sysprof_capture_reader_read_allocation (SysprofCaptureReader *self); SYSPROF_AVAILABLE_IN_ALL -gboolean sysprof_capture_reader_reset (SysprofCaptureReader *self); +bool sysprof_capture_reader_reset (SysprofCaptureReader *self); SYSPROF_AVAILABLE_IN_ALL -gboolean sysprof_capture_reader_splice (SysprofCaptureReader *self, +bool sysprof_capture_reader_splice (SysprofCaptureReader *self, SysprofCaptureWriter *dest, GError **error); SYSPROF_AVAILABLE_IN_ALL -gboolean sysprof_capture_reader_save_as (SysprofCaptureReader *self, +bool sysprof_capture_reader_save_as (SysprofCaptureReader *self, const char *filename, GError **error); SYSPROF_AVAILABLE_IN_ALL -gboolean sysprof_capture_reader_get_stat (SysprofCaptureReader *self, +bool sysprof_capture_reader_get_stat (SysprofCaptureReader *self, SysprofCaptureStat *st_buf); SYSPROF_AVAILABLE_IN_ALL void sysprof_capture_reader_set_stat (SysprofCaptureReader *self, @@ -143,7 +145,7 @@ const SysprofCaptureFileChunk *sysprof_capture_reader_find_file ( SYSPROF_AVAILABLE_IN_ALL char **sysprof_capture_reader_list_files (SysprofCaptureReader *self); SYSPROF_AVAILABLE_IN_ALL -gboolean sysprof_capture_reader_read_file_fd (SysprofCaptureReader *self, +bool sysprof_capture_reader_read_file_fd (SysprofCaptureReader *self, const char *path, int fd); diff --git a/src/libsysprof-capture/sysprof-capture-writer-cat.c b/src/libsysprof-capture/sysprof-capture-writer-cat.c index 504835a6..013db74d 100644 --- a/src/libsysprof-capture/sysprof-capture-writer-cat.c +++ b/src/libsysprof-capture/sysprof-capture-writer-cat.c @@ -59,6 +59,7 @@ #include "config.h" #include +#include #include #include #include @@ -146,7 +147,7 @@ translate_table_translate (GArray **tables, return item != NULL ? item->dst : src; } -gboolean +bool sysprof_capture_writer_cat (SysprofCaptureWriter *self, SysprofCaptureReader *reader, GError **error) @@ -513,7 +514,7 @@ sysprof_capture_writer_cat (SysprofCaptureWriter *self, translate_table_clear (tables, TRANSLATE_ADDR); translate_table_clear (tables, TRANSLATE_CTR); - return TRUE; + return true; panic: g_set_error (error, @@ -524,5 +525,5 @@ panic: translate_table_clear (tables, TRANSLATE_ADDR); translate_table_clear (tables, TRANSLATE_CTR); - return FALSE; + return false; } diff --git a/src/libsysprof-capture/sysprof-capture-writer.c b/src/libsysprof-capture/sysprof-capture-writer.c index 57c176c2..c655a681 100644 --- a/src/libsysprof-capture/sysprof-capture-writer.c +++ b/src/libsysprof-capture/sysprof-capture-writer.c @@ -205,7 +205,7 @@ sysprof_capture_writer_unref (SysprofCaptureWriter *self) sysprof_capture_writer_finalize (self); } -static gboolean +static bool sysprof_capture_writer_flush_data (SysprofCaptureWriter *self) { const uint8_t *buf; @@ -217,7 +217,7 @@ sysprof_capture_writer_flush_data (SysprofCaptureWriter *self) g_assert ((self->pos % SYSPROF_CAPTURE_ALIGN) == 0); if (self->pos == 0) - return TRUE; + return true; buf = self->buf; to_write = self->pos; @@ -226,10 +226,10 @@ sysprof_capture_writer_flush_data (SysprofCaptureWriter *self) { written = _sysprof_write (self->fd, buf, to_write); if (written < 0) - return FALSE; + return false; if (written == 0 && errno != EAGAIN) - return FALSE; + return false; g_assert (written <= (ssize_t)to_write); @@ -239,7 +239,7 @@ sysprof_capture_writer_flush_data (SysprofCaptureWriter *self) self->pos = 0; - return TRUE; + return true; } static inline void @@ -248,21 +248,21 @@ sysprof_capture_writer_realign (size_t *pos) *pos = (*pos + SYSPROF_CAPTURE_ALIGN - 1) & ~(SYSPROF_CAPTURE_ALIGN - 1); } -static inline gboolean +static inline bool sysprof_capture_writer_ensure_space_for (SysprofCaptureWriter *self, size_t len) { /* Check for max frame size */ if (len > USHRT_MAX) - return FALSE; + return false; if ((self->len - self->pos) < len) { if (!sysprof_capture_writer_flush_data (self)) - return FALSE; + return false; } - return TRUE; + return true; } static inline void * @@ -289,7 +289,7 @@ sysprof_capture_writer_allocate (SysprofCaptureWriter *self, return p; } -static gboolean +static bool sysprof_capture_writer_flush_jitmap (SysprofCaptureWriter *self) { SysprofCaptureJitmap jitmap; @@ -299,7 +299,7 @@ sysprof_capture_writer_flush_jitmap (SysprofCaptureWriter *self) g_assert (self != NULL); if (self->addr_hash_size == 0) - return TRUE; + return true; g_assert (self->addr_buf_pos > 0); @@ -316,11 +316,11 @@ sysprof_capture_writer_flush_jitmap (SysprofCaptureWriter *self) jitmap.n_jitmaps = self->addr_hash_size; if (sizeof jitmap != _sysprof_write (self->fd, &jitmap, sizeof jitmap)) - return FALSE; + return false; r = _sysprof_write (self->fd, self->addr_buf, len - sizeof jitmap); if (r < 0 || (size_t)r != (len - sizeof jitmap)) - return FALSE; + return false; self->addr_buf_pos = 0; self->addr_hash_size = 0; @@ -328,10 +328,10 @@ sysprof_capture_writer_flush_jitmap (SysprofCaptureWriter *self) self->stat.frame_count[SYSPROF_CAPTURE_FRAME_JITMAP]++; - return TRUE; + return true; } -static gboolean +static bool sysprof_capture_writer_lookup_jitmap (SysprofCaptureWriter *self, const char *name, SysprofCaptureAddress *addr) @@ -350,12 +350,12 @@ sysprof_capture_writer_lookup_jitmap (SysprofCaptureWriter *self, SysprofCaptureJitmapBucket *bucket = &self->addr_hash[i]; if (bucket->str == NULL) - return FALSE; + return false; if (strcmp (bucket->str, name) == 0) { *addr = bucket->addr; - return TRUE; + return true; } } @@ -364,16 +364,16 @@ sysprof_capture_writer_lookup_jitmap (SysprofCaptureWriter *self, SysprofCaptureJitmapBucket *bucket = &self->addr_hash[i]; if (bucket->str == NULL) - return FALSE; + return false; if (strcmp (bucket->str, name) == 0) { *addr = bucket->addr; - return TRUE; + return true; } } - return FALSE; + return false; } static SysprofCaptureAddress @@ -512,9 +512,9 @@ sysprof_capture_writer_new_from_fd (int fd, header->magic = SYSPROF_CAPTURE_MAGIC; header->version = 1; #if G_BYTE_ORDER == G_LITTLE_ENDIAN - header->little_endian = TRUE; + header->little_endian = true; #else - header->little_endian = FALSE; + header->little_endian = false; #endif header->padding = 0; g_strlcpy (header->capture_time, nowstr, sizeof header->capture_time); @@ -560,7 +560,7 @@ sysprof_capture_writer_new (const char *filename, return self; } -gboolean +bool sysprof_capture_writer_add_map (SysprofCaptureWriter *self, int64_t time, int cpu, @@ -584,7 +584,7 @@ sysprof_capture_writer_add_map (SysprofCaptureWriter *self, ev = (SysprofCaptureMap *)sysprof_capture_writer_allocate (self, &len); if (!ev) - return FALSE; + return false; sysprof_capture_writer_frame_init (&ev->frame, len, @@ -602,10 +602,10 @@ sysprof_capture_writer_add_map (SysprofCaptureWriter *self, self->stat.frame_count[SYSPROF_CAPTURE_FRAME_MAP]++; - return TRUE; + return true; } -gboolean +bool sysprof_capture_writer_add_mark (SysprofCaptureWriter *self, int64_t time, int cpu, @@ -630,7 +630,7 @@ sysprof_capture_writer_add_mark (SysprofCaptureWriter *self, len = sizeof *ev + message_len; ev = (SysprofCaptureMark *)sysprof_capture_writer_allocate (self, &len); if (!ev) - return FALSE; + return false; sysprof_capture_writer_frame_init (&ev->frame, len, @@ -646,10 +646,10 @@ sysprof_capture_writer_add_mark (SysprofCaptureWriter *self, self->stat.frame_count[SYSPROF_CAPTURE_FRAME_MARK]++; - return TRUE; + return true; } -gboolean +bool sysprof_capture_writer_add_metadata (SysprofCaptureWriter *self, int64_t time, int cpu, @@ -676,7 +676,7 @@ sysprof_capture_writer_add_metadata (SysprofCaptureWriter *self, len = sizeof *ev + metadata_len + 1; ev = (SysprofCaptureMetadata *)sysprof_capture_writer_allocate (self, &len); if (!ev) - return FALSE; + return false; sysprof_capture_writer_frame_init (&ev->frame, len, @@ -691,7 +691,7 @@ sysprof_capture_writer_add_metadata (SysprofCaptureWriter *self, self->stat.frame_count[SYSPROF_CAPTURE_FRAME_METADATA]++; - return TRUE; + return true; } SysprofCaptureAddress @@ -712,7 +712,7 @@ sysprof_capture_writer_add_jitmap (SysprofCaptureWriter *self, return addr; } -gboolean +bool sysprof_capture_writer_add_process (SysprofCaptureWriter *self, int64_t time, int cpu, @@ -732,7 +732,7 @@ sysprof_capture_writer_add_process (SysprofCaptureWriter *self, ev = (SysprofCaptureProcess *)sysprof_capture_writer_allocate (self, &len); if (!ev) - return FALSE; + return false; sysprof_capture_writer_frame_init (&ev->frame, len, @@ -746,10 +746,10 @@ sysprof_capture_writer_add_process (SysprofCaptureWriter *self, self->stat.frame_count[SYSPROF_CAPTURE_FRAME_PROCESS]++; - return TRUE; + return true; } -gboolean +bool sysprof_capture_writer_add_sample (SysprofCaptureWriter *self, int64_t time, int cpu, @@ -767,7 +767,7 @@ sysprof_capture_writer_add_sample (SysprofCaptureWriter *self, ev = (SysprofCaptureSample *)sysprof_capture_writer_allocate (self, &len); if (!ev) - return FALSE; + return false; sysprof_capture_writer_frame_init (&ev->frame, len, @@ -782,10 +782,10 @@ sysprof_capture_writer_add_sample (SysprofCaptureWriter *self, self->stat.frame_count[SYSPROF_CAPTURE_FRAME_SAMPLE]++; - return TRUE; + return true; } -gboolean +bool sysprof_capture_writer_add_fork (SysprofCaptureWriter *self, int64_t time, int cpu, @@ -799,7 +799,7 @@ sysprof_capture_writer_add_fork (SysprofCaptureWriter *self, ev = (SysprofCaptureFork *)sysprof_capture_writer_allocate (self, &len); if (!ev) - return FALSE; + return false; sysprof_capture_writer_frame_init (&ev->frame, len, @@ -811,10 +811,10 @@ sysprof_capture_writer_add_fork (SysprofCaptureWriter *self, self->stat.frame_count[SYSPROF_CAPTURE_FRAME_FORK]++; - return TRUE; + return true; } -gboolean +bool sysprof_capture_writer_add_exit (SysprofCaptureWriter *self, int64_t time, int cpu, @@ -827,7 +827,7 @@ sysprof_capture_writer_add_exit (SysprofCaptureWriter *self, ev = (SysprofCaptureExit *)sysprof_capture_writer_allocate (self, &len); if (!ev) - return FALSE; + return false; sysprof_capture_writer_frame_init (&ev->frame, len, @@ -838,10 +838,10 @@ sysprof_capture_writer_add_exit (SysprofCaptureWriter *self, self->stat.frame_count[SYSPROF_CAPTURE_FRAME_EXIT]++; - return TRUE; + return true; } -gboolean +bool sysprof_capture_writer_add_timestamp (SysprofCaptureWriter *self, int64_t time, int cpu, @@ -854,7 +854,7 @@ sysprof_capture_writer_add_timestamp (SysprofCaptureWriter *self, ev = (SysprofCaptureTimestamp *)sysprof_capture_writer_allocate (self, &len); if (!ev) - return FALSE; + return false; sysprof_capture_writer_frame_init (&ev->frame, len, @@ -865,10 +865,10 @@ sysprof_capture_writer_add_timestamp (SysprofCaptureWriter *self, self->stat.frame_count[SYSPROF_CAPTURE_FRAME_TIMESTAMP]++; - return TRUE; + return true; } -static gboolean +static bool sysprof_capture_writer_flush_end_time (SysprofCaptureWriter *self) { int64_t end_time = SYSPROF_CAPTURE_CURRENT_TIME; @@ -887,10 +887,10 @@ again: if (ret < 0 && errno == EAGAIN) goto again; - return TRUE; + return true; } -gboolean +bool sysprof_capture_writer_flush (SysprofCaptureWriter *self) { g_assert (self != NULL); @@ -913,7 +913,7 @@ sysprof_capture_writer_flush (SysprofCaptureWriter *self) * * Returns: %TRUE if successful, otherwise %FALSE and @error is set. */ -gboolean +bool sysprof_capture_writer_save_as (SysprofCaptureWriter *self, const char *filename, GError **error) @@ -958,7 +958,7 @@ sysprof_capture_writer_save_as (SysprofCaptureWriter *self, close (fd); - return TRUE; + return true; handle_errno: g_set_error (error, @@ -972,7 +972,7 @@ handle_errno: g_unlink (filename); } - return FALSE; + return false; } /** @@ -991,7 +991,7 @@ handle_errno: * * Returns: %TRUE if successful; otherwise %FALSE and @error is set. */ -gboolean +bool _sysprof_capture_writer_splice_from_fd (SysprofCaptureWriter *self, int fd, GError **error) @@ -1012,7 +1012,7 @@ _sysprof_capture_writer_splice_from_fd (SysprofCaptureWriter *self, G_FILE_ERROR, G_FILE_ERROR_INVAL, "Cannot splice, possibly corrupt file."); - return FALSE; + return false; } in_off = 256; @@ -1035,7 +1035,7 @@ _sysprof_capture_writer_splice_from_fd (SysprofCaptureWriter *self, to_write -= written; } - return TRUE; + return true; handle_errno: g_set_error (error, @@ -1043,7 +1043,7 @@ handle_errno: g_file_error_from_errno (errno), "%s", g_strerror (errno)); - return FALSE; + return false; } /** @@ -1059,12 +1059,12 @@ handle_errno: * * Returns: %TRUE if successful, otherwise %FALSE and and @error is set. */ -gboolean +bool sysprof_capture_writer_splice (SysprofCaptureWriter *self, SysprofCaptureWriter *dest, GError **error) { - gboolean ret; + bool ret; off_t pos; g_assert (self != NULL); @@ -1086,7 +1086,7 @@ sysprof_capture_writer_splice (SysprofCaptureWriter *self, /* Now reset or file-descriptor position (it should be the same */ if (pos != lseek (self->fd, pos, SEEK_SET)) { - ret = FALSE; + ret = false; goto handle_errno; } @@ -1098,7 +1098,7 @@ handle_errno: g_file_error_from_errno (errno), "%s", g_strerror (errno)); - return FALSE; + return false; } /** @@ -1165,7 +1165,7 @@ sysprof_capture_writer_stat (SysprofCaptureWriter *self, *stat = self->stat; } -gboolean +bool sysprof_capture_writer_define_counters (SysprofCaptureWriter *self, int64_t time, int cpu, @@ -1181,13 +1181,13 @@ sysprof_capture_writer_define_counters (SysprofCaptureWriter *self, g_assert (counters != NULL); if (n_counters == 0) - return TRUE; + return true; len = sizeof *def + (sizeof *counters * n_counters); def = (SysprofCaptureCounterDefine *)sysprof_capture_writer_allocate (self, &len); if (!def) - return FALSE; + return false; sysprof_capture_writer_frame_init (&def->frame, len, @@ -1212,10 +1212,10 @@ sysprof_capture_writer_define_counters (SysprofCaptureWriter *self, self->stat.frame_count[SYSPROF_CAPTURE_FRAME_CTRDEF]++; - return TRUE; + return true; } -gboolean +bool sysprof_capture_writer_set_counters (SysprofCaptureWriter *self, int64_t time, int cpu, @@ -1236,7 +1236,7 @@ sysprof_capture_writer_set_counters (SysprofCaptureWriter *self, g_assert (values != NULL || !n_counters); if (n_counters == 0) - return TRUE; + return true; /* Determine how many value groups we need */ n_groups = n_counters / G_N_ELEMENTS (set->values[0].values); @@ -1247,7 +1247,7 @@ sysprof_capture_writer_set_counters (SysprofCaptureWriter *self, set = (SysprofCaptureCounterSet *)sysprof_capture_writer_allocate (self, &len); if (!set) - return FALSE; + return false; memset (set, 0, len); @@ -1277,7 +1277,7 @@ sysprof_capture_writer_set_counters (SysprofCaptureWriter *self, self->stat.frame_count[SYSPROF_CAPTURE_FRAME_CTRSET]++; - return TRUE; + return true; } /** @@ -1310,7 +1310,7 @@ sysprof_capture_writer_request_counter (SysprofCaptureWriter *self, return ret; } -gboolean +bool _sysprof_capture_writer_set_time_range (SysprofCaptureWriter *self, int64_t start_time, int64_t end_time) @@ -1337,7 +1337,7 @@ do_end: if (ret < 0 && errno == EAGAIN) goto do_end; - return TRUE; + return true; } SysprofCaptureWriter * @@ -1370,7 +1370,7 @@ sysprof_capture_writer_get_buffer_size (SysprofCaptureWriter *self) return self->len; } -gboolean +bool sysprof_capture_writer_add_log (SysprofCaptureWriter *self, int64_t time, int cpu, @@ -1395,7 +1395,7 @@ sysprof_capture_writer_add_log (SysprofCaptureWriter *self, len = sizeof *ev + message_len; ev = (SysprofCaptureLog *)sysprof_capture_writer_allocate (self, &len); if (!ev) - return FALSE; + return false; sysprof_capture_writer_frame_init (&ev->frame, len, @@ -1412,10 +1412,10 @@ sysprof_capture_writer_add_log (SysprofCaptureWriter *self, self->stat.frame_count[SYSPROF_CAPTURE_FRAME_LOG]++; - return TRUE; + return true; } -gboolean +bool sysprof_capture_writer_add_file (SysprofCaptureWriter *self, int64_t time, int cpu, @@ -1433,7 +1433,7 @@ sysprof_capture_writer_add_file (SysprofCaptureWriter *self, len = sizeof *ev + data_len; ev = (SysprofCaptureFileChunk *)sysprof_capture_writer_allocate (self, &len); if (!ev) - return FALSE; + return false; sysprof_capture_writer_frame_init (&ev->frame, len, @@ -1450,10 +1450,10 @@ sysprof_capture_writer_add_file (SysprofCaptureWriter *self, self->stat.frame_count[SYSPROF_CAPTURE_FRAME_FILE_CHUNK]++; - return TRUE; + return true; } -gboolean +bool sysprof_capture_writer_add_file_fd (SysprofCaptureWriter *self, int64_t time, int cpu, @@ -1467,7 +1467,7 @@ sysprof_capture_writer_add_file_fd (SysprofCaptureWriter *self, for (;;) { - gboolean is_last; + bool is_last; ssize_t n_read; again: @@ -1478,13 +1478,13 @@ sysprof_capture_writer_add_file_fd (SysprofCaptureWriter *self, is_last = n_read == 0; if (!sysprof_capture_writer_add_file (self, time, cpu, pid, path, is_last, data, n_read)) - return FALSE; + return false; if (is_last) break; } - return TRUE; + return true; } static gboolean @@ -1523,7 +1523,7 @@ sysprof_capture_writer_set_flush_delay (SysprofCaptureWriter *self, g_source_attach (self->periodic_flush, main_context); } -gboolean +bool sysprof_capture_writer_add_allocation (SysprofCaptureWriter *self, int64_t time, int cpu, @@ -1544,7 +1544,7 @@ sysprof_capture_writer_add_allocation (SysprofCaptureWriter *self, len = sizeof *ev + (MAX_UNWIND_DEPTH * sizeof (SysprofCaptureAddress)); ev = (SysprofCaptureAllocation *)sysprof_capture_writer_allocate (self, &len); if (!ev) - return FALSE; + return false; sysprof_capture_writer_frame_init (&ev->frame, len, @@ -1574,10 +1574,10 @@ sysprof_capture_writer_add_allocation (SysprofCaptureWriter *self, self->stat.frame_count[SYSPROF_CAPTURE_FRAME_ALLOCATION]++; - return TRUE; + return true; } -gboolean +bool sysprof_capture_writer_add_allocation_copy (SysprofCaptureWriter *self, int64_t time, int cpu, @@ -1599,7 +1599,7 @@ sysprof_capture_writer_add_allocation_copy (SysprofCaptureWriter *self, len = sizeof *ev + (n_addrs * sizeof (SysprofCaptureAddress)); ev = (SysprofCaptureAllocation *)sysprof_capture_writer_allocate (self, &len); if (!ev) - return FALSE; + return false; sysprof_capture_writer_frame_init (&ev->frame, len, @@ -1618,10 +1618,10 @@ sysprof_capture_writer_add_allocation_copy (SysprofCaptureWriter *self, self->stat.frame_count[SYSPROF_CAPTURE_FRAME_ALLOCATION]++; - return TRUE; + return true; } -gboolean +bool _sysprof_capture_writer_add_raw (SysprofCaptureWriter *self, const SysprofCaptureFrame *fr) { @@ -1635,7 +1635,7 @@ _sysprof_capture_writer_add_raw (SysprofCaptureWriter *self, len = fr->len; if (!(begin = sysprof_capture_writer_allocate (self, &len))) - return FALSE; + return false; g_assert (fr->len == len); g_assert (fr->type < 16); @@ -1645,5 +1645,5 @@ _sysprof_capture_writer_add_raw (SysprofCaptureWriter *self, if (fr->type < G_N_ELEMENTS (self->stat.frame_count)) self->stat.frame_count[fr->type]++; - return TRUE; + return true; } diff --git a/src/libsysprof-capture/sysprof-capture-writer.h b/src/libsysprof-capture/sysprof-capture-writer.h index a20bb822..d2f96c30 100644 --- a/src/libsysprof-capture/sysprof-capture-writer.h +++ b/src/libsysprof-capture/sysprof-capture-writer.h @@ -56,6 +56,7 @@ #pragma once +#include #include #include @@ -101,23 +102,23 @@ void sysprof_capture_writer_set_flush_delay (Sy GMainContext *main_context, unsigned int timeout_seconds); SYSPROF_AVAILABLE_IN_ALL -gboolean sysprof_capture_writer_add_file (SysprofCaptureWriter *self, +bool sysprof_capture_writer_add_file (SysprofCaptureWriter *self, int64_t time, int cpu, int32_t pid, const char *path, - gboolean is_last, + bool is_last, const uint8_t *data, size_t data_len); SYSPROF_AVAILABLE_IN_ALL -gboolean sysprof_capture_writer_add_file_fd (SysprofCaptureWriter *self, +bool sysprof_capture_writer_add_file_fd (SysprofCaptureWriter *self, int64_t time, int cpu, int32_t pid, const char *path, int fd); SYSPROF_AVAILABLE_IN_ALL -gboolean sysprof_capture_writer_add_map (SysprofCaptureWriter *self, +bool sysprof_capture_writer_add_map (SysprofCaptureWriter *self, int64_t time, int cpu, int32_t pid, @@ -127,7 +128,7 @@ gboolean sysprof_capture_writer_add_map (Sy uint64_t inode, const char *filename); SYSPROF_AVAILABLE_IN_ALL -gboolean sysprof_capture_writer_add_mark (SysprofCaptureWriter *self, +bool sysprof_capture_writer_add_mark (SysprofCaptureWriter *self, int64_t time, int cpu, int32_t pid, @@ -136,7 +137,7 @@ gboolean sysprof_capture_writer_add_mark (Sy const char *name, const char *message); SYSPROF_AVAILABLE_IN_ALL -gboolean sysprof_capture_writer_add_metadata (SysprofCaptureWriter *self, +bool sysprof_capture_writer_add_metadata (SysprofCaptureWriter *self, int64_t time, int cpu, int32_t pid, @@ -147,13 +148,13 @@ SYSPROF_AVAILABLE_IN_ALL uint64_t sysprof_capture_writer_add_jitmap (SysprofCaptureWriter *self, const char *name); SYSPROF_AVAILABLE_IN_ALL -gboolean sysprof_capture_writer_add_process (SysprofCaptureWriter *self, +bool sysprof_capture_writer_add_process (SysprofCaptureWriter *self, int64_t time, int cpu, int32_t pid, const char *cmdline); SYSPROF_AVAILABLE_IN_ALL -gboolean sysprof_capture_writer_add_sample (SysprofCaptureWriter *self, +bool sysprof_capture_writer_add_sample (SysprofCaptureWriter *self, int64_t time, int cpu, int32_t pid, @@ -161,30 +162,30 @@ gboolean sysprof_capture_writer_add_sample (Sy const SysprofCaptureAddress *addrs, unsigned int n_addrs); SYSPROF_AVAILABLE_IN_ALL -gboolean sysprof_capture_writer_add_fork (SysprofCaptureWriter *self, +bool sysprof_capture_writer_add_fork (SysprofCaptureWriter *self, int64_t time, int cpu, int32_t pid, int32_t child_pid); SYSPROF_AVAILABLE_IN_ALL -gboolean sysprof_capture_writer_add_exit (SysprofCaptureWriter *self, +bool sysprof_capture_writer_add_exit (SysprofCaptureWriter *self, int64_t time, int cpu, int32_t pid); SYSPROF_AVAILABLE_IN_ALL -gboolean sysprof_capture_writer_add_timestamp (SysprofCaptureWriter *self, +bool sysprof_capture_writer_add_timestamp (SysprofCaptureWriter *self, int64_t time, int cpu, int32_t pid); SYSPROF_AVAILABLE_IN_ALL -gboolean sysprof_capture_writer_define_counters (SysprofCaptureWriter *self, +bool sysprof_capture_writer_define_counters (SysprofCaptureWriter *self, int64_t time, int cpu, int32_t pid, const SysprofCaptureCounter *counters, unsigned int n_counters); SYSPROF_AVAILABLE_IN_ALL -gboolean sysprof_capture_writer_set_counters (SysprofCaptureWriter *self, +bool sysprof_capture_writer_set_counters (SysprofCaptureWriter *self, int64_t time, int cpu, int32_t pid, @@ -192,7 +193,7 @@ gboolean sysprof_capture_writer_set_counters (Sy const SysprofCaptureCounterValue *values, unsigned int n_counters); SYSPROF_AVAILABLE_IN_ALL -gboolean sysprof_capture_writer_add_log (SysprofCaptureWriter *self, +bool sysprof_capture_writer_add_log (SysprofCaptureWriter *self, int64_t time, int cpu, int32_t pid, @@ -200,7 +201,7 @@ gboolean sysprof_capture_writer_add_log (Sy const char *domain, const char *message); SYSPROF_AVAILABLE_IN_3_36 -gboolean sysprof_capture_writer_add_allocation (SysprofCaptureWriter *self, +bool sysprof_capture_writer_add_allocation (SysprofCaptureWriter *self, int64_t time, int cpu, int32_t pid, @@ -210,7 +211,7 @@ gboolean sysprof_capture_writer_add_allocation (Sy SysprofBacktraceFunc backtrace_func, void *backtrace_data); SYSPROF_AVAILABLE_IN_3_36 -gboolean sysprof_capture_writer_add_allocation_copy (SysprofCaptureWriter *self, +bool sysprof_capture_writer_add_allocation_copy (SysprofCaptureWriter *self, int64_t time, int cpu, int32_t pid, @@ -220,9 +221,9 @@ gboolean sysprof_capture_writer_add_allocation_copy (Sy const SysprofCaptureAddress *addrs, unsigned int n_addrs); SYSPROF_AVAILABLE_IN_ALL -gboolean sysprof_capture_writer_flush (SysprofCaptureWriter *self); +bool sysprof_capture_writer_flush (SysprofCaptureWriter *self); SYSPROF_AVAILABLE_IN_ALL -gboolean sysprof_capture_writer_save_as (SysprofCaptureWriter *self, +bool sysprof_capture_writer_save_as (SysprofCaptureWriter *self, const char *filename, GError **error); SYSPROF_AVAILABLE_IN_ALL @@ -232,22 +233,22 @@ SYSPROF_AVAILABLE_IN_ALL SysprofCaptureReader *sysprof_capture_writer_create_reader (SysprofCaptureWriter *self, GError **error); SYSPROF_AVAILABLE_IN_ALL -gboolean sysprof_capture_writer_splice (SysprofCaptureWriter *self, +bool sysprof_capture_writer_splice (SysprofCaptureWriter *self, SysprofCaptureWriter *dest, GError **error); SYSPROF_AVAILABLE_IN_ALL -gboolean sysprof_capture_writer_cat (SysprofCaptureWriter *self, +bool sysprof_capture_writer_cat (SysprofCaptureWriter *self, SysprofCaptureReader *reader, GError **error); G_GNUC_INTERNAL -gboolean _sysprof_capture_writer_add_raw (SysprofCaptureWriter *self, +bool _sysprof_capture_writer_add_raw (SysprofCaptureWriter *self, const SysprofCaptureFrame *frame); G_GNUC_INTERNAL -gboolean _sysprof_capture_writer_splice_from_fd (SysprofCaptureWriter *self, +bool _sysprof_capture_writer_splice_from_fd (SysprofCaptureWriter *self, int fd, GError **error) G_GNUC_INTERNAL; G_GNUC_INTERNAL -gboolean _sysprof_capture_writer_set_time_range (SysprofCaptureWriter *self, +bool _sysprof_capture_writer_set_time_range (SysprofCaptureWriter *self, int64_t start_time, int64_t end_time) G_GNUC_INTERNAL; diff --git a/src/libsysprof-capture/sysprof-clock.c b/src/libsysprof-capture/sysprof-clock.c index f517deea..004305e9 100644 --- a/src/libsysprof-capture/sysprof-clock.c +++ b/src/libsysprof-capture/sysprof-clock.c @@ -58,6 +58,8 @@ #include "config.h" +#include + #include "sysprof-clock.h" int sysprof_clock = -1; diff --git a/src/libsysprof-capture/sysprof-collector.c b/src/libsysprof-capture/sysprof-collector.c index 29e74318..1d1b40fe 100644 --- a/src/libsysprof-capture/sysprof-collector.c +++ b/src/libsysprof-capture/sysprof-collector.c @@ -66,6 +66,7 @@ #ifdef __linux__ # include #endif +#include #include #include #include @@ -82,7 +83,7 @@ typedef struct { MappedRingBuffer *buffer; - gboolean is_shared; + bool is_shared; int tid; int pid; } SysprofCollector; @@ -99,7 +100,7 @@ static GPrivate single_trace_key = G_PRIVATE_INIT (NULL); static SysprofCollector *shared_collector; static SysprofCollector invalid; -static inline gboolean +static inline bool use_single_trace (void) { return GPOINTER_TO_INT (g_private_get (&single_trace_key)); diff --git a/src/libsysprof/sysprof-control-source.c b/src/libsysprof/sysprof-control-source.c index fdf8f504..e39ebde8 100644 --- a/src/libsysprof/sysprof-control-source.c +++ b/src/libsysprof/sysprof-control-source.c @@ -123,10 +123,10 @@ sysprof_control_source_init (SysprofControlSource *self) g_array_set_clear_func (self->source_ids, remove_source_id); } -static gboolean -event_frame_cb (gconstpointer data, - gsize *length, - gpointer user_data) +static bool +event_frame_cb (const void *data, + size_t *length, + void *user_data) { const SysprofCaptureFrame *fr = data; RingData *rd = user_data; diff --git a/src/libsysprof/sysprof-local-profiler.c b/src/libsysprof/sysprof-local-profiler.c index f993a8e1..0fc32aaf 100644 --- a/src/libsysprof/sysprof-local-profiler.c +++ b/src/libsysprof/sysprof-local-profiler.c @@ -983,9 +983,9 @@ profiler_iface_init (SysprofProfilerInterface *iface) iface->stopped = sysprof_local_profiler_real_stopped; } -static gboolean +static bool find_profiler_meta_cb (const SysprofCaptureFrame *frame, - gpointer user_data) + void *user_data) { const SysprofCaptureMetadata *meta = (const SysprofCaptureMetadata *)frame; GKeyFile **keyfile = user_data; @@ -1006,7 +1006,7 @@ find_profiler_meta_cb (const SysprofCaptureFrame *frame, return *keyfile == NULL; } - return TRUE; + return true; } SysprofProfiler * diff --git a/src/libsysprof/sysprof-memprof-profile.c b/src/libsysprof/sysprof-memprof-profile.c index dca1cca1..30984106 100644 --- a/src/libsysprof/sysprof-memprof-profile.c +++ b/src/libsysprof/sysprof-memprof-profile.c @@ -251,9 +251,9 @@ create_cursor (SysprofCaptureReader *reader) return cursor; } -static gboolean +static bool all_allocs_foreach_cb (const SysprofCaptureFrame *frame, - gpointer user_data) + void *user_data) { Generate *g = user_data; @@ -273,12 +273,12 @@ all_allocs_foreach_cb (const SysprofCaptureFrame *frame, (gchar *)g_string_chunk_insert_const (g->symbols, cmdline)); } - return TRUE; + return true; } /* Short-circuit if we don't care about this frame */ if (!sysprof_selection_contains (g->selection, frame->time)) - return TRUE; + return true; if (frame->type == SYSPROF_CAPTURE_FRAME_ALLOCATION) { @@ -361,7 +361,7 @@ all_allocs_foreach_cb (const SysprofCaptureFrame *frame, } } - return TRUE; + return true; } static gint diff --git a/src/tests/test-capture-cursor.c b/src/tests/test-capture-cursor.c index dc24cba9..dd884160 100644 --- a/src/tests/test-capture-cursor.c +++ b/src/tests/test-capture-cursor.c @@ -22,13 +22,13 @@ #include #include -static gboolean +static bool increment (const SysprofCaptureFrame *frame, - gpointer user_data) + void *user_data) { gint *count= user_data; (*count)++; - return TRUE; + return true; } static void diff --git a/src/tests/test-mapped-ring-buffer.c b/src/tests/test-mapped-ring-buffer.c index 3213c7e4..707c0dcb 100644 --- a/src/tests/test-mapped-ring-buffer.c +++ b/src/tests/test-mapped-ring-buffer.c @@ -5,10 +5,10 @@ static gsize real_count; -static gboolean -drain_nth_cb (gconstpointer data, - gsize *len, - gpointer user_data) +static bool +drain_nth_cb (const void *data, + size_t *len, + void *user_data) { const gint64 *v64 = data; g_assert_cmpint (*len, >=, 8); @@ -17,10 +17,10 @@ drain_nth_cb (gconstpointer data, return G_SOURCE_CONTINUE; } -static gboolean -drain_count_cb (gconstpointer data, - gsize *len, - gpointer user_data) +static bool +drain_count_cb (const void *data, + size_t *len, + void *user_data) { const gint64 *v64 = data; g_assert_cmpint (*len, >=, 8); @@ -93,10 +93,10 @@ typedef struct gint64 done; } ThreadedMessage; -static gboolean -handle_msg (gconstpointer data, - gsize *length, - gpointer user_data) +static bool +handle_msg (const void *data, + size_t *length, + void *user_data) { const ThreadedMessage *msg = data; gboolean *done = user_data; diff --git a/src/tools/list-threads.c b/src/tools/list-threads.c index 5016c7bd..30837c57 100644 --- a/src/tools/list-threads.c +++ b/src/tools/list-threads.c @@ -26,9 +26,9 @@ #include "../libsysprof/sysprof-capture-autocleanups.h" -static gboolean +static bool foreach_cb (const SysprofCaptureFrame *frame, - gpointer user_data) + void *user_data) { const SysprofCaptureSample *sample = (SysprofCaptureSample *)frame; GHashTable *seen = user_data; @@ -38,7 +38,7 @@ foreach_cb (const SysprofCaptureFrame *frame, GINT_TO_POINTER (sample->tid), GINT_TO_POINTER (frame->pid)); - return TRUE; + return true; } gint