libsysprof-capture: Use stdbool instead of gboolean

Another step towards dropping GLib as a dependency of
libsysprof-capture.

Unlike the previous commit which replaced GLib integer types with the
bitwise equivalent C standard types, `stdbool` is potentially a different
width from `gboolean`, so this is an ABI break.

It therefore involves some changes to callback functions in the tests
and tools, and in libsysprof.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

Helps: #40
This commit is contained in:
Philip Withnall
2020-07-01 15:35:51 +01:00
parent 2c2cbf6343
commit 5636bbf4f0
20 changed files with 235 additions and 220 deletions

View File

@ -478,7 +478,7 @@ mapped_ring_buffer_advance (MappedRingBuffer *self,
* Returns: %TRUE if the buffer was drained, %FALSE if @callback prematurely * Returns: %TRUE if the buffer was drained, %FALSE if @callback prematurely
* returned while draining. * returned while draining.
*/ */
gboolean bool
mapped_ring_buffer_drain (MappedRingBuffer *self, mapped_ring_buffer_drain (MappedRingBuffer *self,
MappedRingBufferCallback callback, MappedRingBufferCallback callback,
void *user_data) void *user_data)
@ -499,7 +499,7 @@ mapped_ring_buffer_drain (MappedRingBuffer *self,
g_assert (tailpos < self->body_size); g_assert (tailpos < self->body_size);
if (headpos == tailpos) if (headpos == tailpos)
return TRUE; return true;
/* If head needs to wrap around to get to tail, we can just rely on /* If head needs to wrap around to get to tail, we can just rely on
* our double mapping instead actually manually wrapping/copying data. * our double mapping instead actually manually wrapping/copying data.
@ -515,10 +515,10 @@ mapped_ring_buffer_drain (MappedRingBuffer *self,
size_t len = tailpos - headpos; size_t len = tailpos - headpos;
if (!callback (data, &len, user_data)) if (!callback (data, &len, user_data))
return FALSE; return false;
if (len > (tailpos - headpos)) if (len > (tailpos - headpos))
return FALSE; return false;
headpos += len; headpos += len;
@ -528,7 +528,7 @@ mapped_ring_buffer_drain (MappedRingBuffer *self,
g_atomic_int_set (&header->head, headpos); 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 * Returns: %TRUE if the buffer is empty, %FALSE otherwise
*/ */
gboolean bool
mapped_ring_buffer_is_empty (MappedRingBuffer *self) mapped_ring_buffer_is_empty (MappedRingBuffer *self)
{ {
MappedRingHeader *header; MappedRingHeader *header;

View File

@ -21,6 +21,7 @@
#pragma once #pragma once
#include <glib.h> #include <glib.h>
#include <stdbool.h>
#include <stddef.h> #include <stddef.h>
G_BEGIN_DECLS G_BEGIN_DECLS
@ -50,9 +51,9 @@ typedef struct _MappedRingBuffer MappedRingBuffer;
* *
* Returns: %TRUE to coninue draining, otherwise %FALSE and draining stops * Returns: %TRUE to coninue draining, otherwise %FALSE and draining stops
*/ */
typedef gboolean (*MappedRingBufferCallback) (const void *data, typedef bool (*MappedRingBufferCallback) (const void *data,
size_t *length, size_t *length,
void *user_data); void *user_data);
G_GNUC_INTERNAL G_GNUC_INTERNAL
MappedRingBuffer *mapped_ring_buffer_new_reader (size_t buffer_size); MappedRingBuffer *mapped_ring_buffer_new_reader (size_t buffer_size);
@ -75,10 +76,10 @@ G_GNUC_INTERNAL
void mapped_ring_buffer_advance (MappedRingBuffer *self, void mapped_ring_buffer_advance (MappedRingBuffer *self,
size_t length); size_t length);
G_GNUC_INTERNAL G_GNUC_INTERNAL
gboolean mapped_ring_buffer_drain (MappedRingBuffer *self, bool mapped_ring_buffer_drain (MappedRingBuffer *self,
MappedRingBufferCallback callback, MappedRingBufferCallback callback,
void *user_data); void *user_data);
G_GNUC_INTERNAL G_GNUC_INTERNAL
gboolean mapped_ring_buffer_is_empty (MappedRingBuffer *self); bool mapped_ring_buffer_is_empty (MappedRingBuffer *self);
G_END_DECLS G_END_DECLS

View File

@ -61,10 +61,11 @@
#else #else
# include "sysprof-address-fallback.h" # include "sysprof-address-fallback.h"
#endif #endif
#include <stdbool.h>
#include "sysprof-address.h" #include "sysprof-address.h"
gboolean bool
sysprof_address_is_context_switch (SysprofAddress address, sysprof_address_is_context_switch (SysprofAddress address,
SysprofAddressContext *context) SysprofAddressContext *context)
{ {
@ -77,31 +78,31 @@ sysprof_address_is_context_switch (SysprofAddress address,
{ {
case PERF_CONTEXT_HV: case PERF_CONTEXT_HV:
*context = SYSPROF_ADDRESS_CONTEXT_HYPERVISOR; *context = SYSPROF_ADDRESS_CONTEXT_HYPERVISOR;
return TRUE; return true;
case PERF_CONTEXT_KERNEL: case PERF_CONTEXT_KERNEL:
*context = SYSPROF_ADDRESS_CONTEXT_KERNEL; *context = SYSPROF_ADDRESS_CONTEXT_KERNEL;
return TRUE; return true;
case PERF_CONTEXT_USER: case PERF_CONTEXT_USER:
*context = SYSPROF_ADDRESS_CONTEXT_USER; *context = SYSPROF_ADDRESS_CONTEXT_USER;
return TRUE; return true;
case PERF_CONTEXT_GUEST: case PERF_CONTEXT_GUEST:
*context = SYSPROF_ADDRESS_CONTEXT_GUEST; *context = SYSPROF_ADDRESS_CONTEXT_GUEST;
return TRUE; return true;
case PERF_CONTEXT_GUEST_KERNEL: case PERF_CONTEXT_GUEST_KERNEL:
*context = SYSPROF_ADDRESS_CONTEXT_GUEST_KERNEL; *context = SYSPROF_ADDRESS_CONTEXT_GUEST_KERNEL;
return TRUE; return true;
case PERF_CONTEXT_GUEST_USER: case PERF_CONTEXT_GUEST_USER:
*context = SYSPROF_ADDRESS_CONTEXT_GUEST_USER; *context = SYSPROF_ADDRESS_CONTEXT_GUEST_USER;
return TRUE; return true;
default: default:
*context = SYSPROF_ADDRESS_CONTEXT_NONE; *context = SYSPROF_ADDRESS_CONTEXT_NONE;
return FALSE; return false;
} }
} }

View File

@ -56,6 +56,7 @@
#pragma once #pragma once
#include <stdbool.h>
#include <stdint.h> #include <stdint.h>
#include "sysprof-version-macros.h" #include "sysprof-version-macros.h"
@ -78,7 +79,7 @@ typedef enum
} SysprofAddressContext; } SysprofAddressContext;
SYSPROF_AVAILABLE_IN_ALL SYSPROF_AVAILABLE_IN_ALL
gboolean sysprof_address_is_context_switch (SysprofAddress address, bool sysprof_address_is_context_switch (SysprofAddress address,
SysprofAddressContext *context); SysprofAddressContext *context);
SYSPROF_AVAILABLE_IN_ALL SYSPROF_AVAILABLE_IN_ALL
const char *sysprof_address_context_to_string (SysprofAddressContext context); const char *sysprof_address_context_to_string (SysprofAddressContext context);

View File

@ -58,6 +58,7 @@
#include "config.h" #include "config.h"
#include <stdbool.h>
#include <string.h> #include <string.h>
#include "sysprof-capture-condition.h" #include "sysprof-capture-condition.h"
@ -104,7 +105,7 @@ struct _SysprofCaptureCondition
} u; } u;
}; };
gboolean bool
sysprof_capture_condition_match (const SysprofCaptureCondition *self, sysprof_capture_condition_match (const SysprofCaptureCondition *self,
const SysprofCaptureFrame *frame) 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++) 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)) 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: case SYSPROF_CAPTURE_CONDITION_WHERE_TIME_BETWEEN:
return (frame->time >= self->u.where_time_between.begin && frame->time <= self->u.where_time_between.end); 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++) 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)) 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: case SYSPROF_CAPTURE_CONDITION_WHERE_COUNTER_IN:
if (frame->type == SYSPROF_CAPTURE_FRAME_CTRSET) 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[5] ||
counter == set->values[j].ids[6] || counter == set->values[j].ids[6] ||
counter == set->values[j].ids[7]) 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++) for (unsigned int j = 0; j < def->n_counters; j++)
{ {
if (def->counters[j].id == counter) if (def->counters[j].id == counter)
return TRUE; return true;
} }
} }
} }
return FALSE; return false;
case SYSPROF_CAPTURE_CONDITION_WHERE_FILE: case SYSPROF_CAPTURE_CONDITION_WHERE_FILE:
if (frame->type != SYSPROF_CAPTURE_FRAME_FILE_CHUNK) if (frame->type != SYSPROF_CAPTURE_FRAME_FILE_CHUNK)
return FALSE; return false;
return g_strcmp0 (((const SysprofCaptureFileChunk *)frame)->path, self->u.where_file) == 0; 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 (); g_assert_not_reached ();
return FALSE; return false;
} }
static SysprofCaptureCondition * static SysprofCaptureCondition *

View File

@ -56,6 +56,8 @@
#pragma once #pragma once
#include <stdbool.h>
#include "sysprof-capture-types.h" #include "sysprof-capture-types.h"
#include "sysprof-version-macros.h" #include "sysprof-version-macros.h"
@ -88,7 +90,7 @@ SysprofCaptureCondition *sysprof_capture_condition_new_where_counter_in (unsig
SYSPROF_AVAILABLE_IN_ALL SYSPROF_AVAILABLE_IN_ALL
SysprofCaptureCondition *sysprof_capture_condition_new_where_file (const char *path); SysprofCaptureCondition *sysprof_capture_condition_new_where_file (const char *path);
SYSPROF_AVAILABLE_IN_ALL SYSPROF_AVAILABLE_IN_ALL
gboolean sysprof_capture_condition_match (const SysprofCaptureCondition *self, bool sysprof_capture_condition_match (const SysprofCaptureCondition *self,
const SysprofCaptureFrame *frame); const SysprofCaptureFrame *frame);
G_END_DECLS G_END_DECLS

View File

@ -56,6 +56,8 @@
#pragma once #pragma once
#include <stdbool.h>
#include "sysprof-capture-types.h" #include "sysprof-capture-types.h"
#include "sysprof-version-macros.h" #include "sysprof-version-macros.h"
@ -74,8 +76,8 @@ typedef struct _SysprofCaptureCursor SysprofCaptureCursor;
* *
* Returns: %TRUE if iteration should continue, otherwise %FALSE. * Returns: %TRUE if iteration should continue, otherwise %FALSE.
*/ */
typedef gboolean (*SysprofCaptureCursorCallback) (const SysprofCaptureFrame *frame, typedef bool (*SysprofCaptureCursorCallback) (const SysprofCaptureFrame *frame,
void *user_data); void *user_data);
SYSPROF_AVAILABLE_IN_ALL SYSPROF_AVAILABLE_IN_ALL
SysprofCaptureCursor *sysprof_capture_cursor_new (SysprofCaptureReader *reader); SysprofCaptureCursor *sysprof_capture_cursor_new (SysprofCaptureReader *reader);

View File

@ -87,7 +87,7 @@ struct _SysprofCaptureReader
unsigned int st_buf_set : 1; unsigned int st_buf_set : 1;
}; };
static gboolean static bool
sysprof_capture_reader_read_file_header (SysprofCaptureReader *self, sysprof_capture_reader_read_file_header (SysprofCaptureReader *self,
SysprofCaptureFileHeader *header, SysprofCaptureFileHeader *header,
GError **error) GError **error)
@ -101,7 +101,7 @@ sysprof_capture_reader_read_file_header (SysprofCaptureReader *self,
G_FILE_ERROR, G_FILE_ERROR,
g_file_error_from_errno (errno), g_file_error_from_errno (errno),
"%s", g_strerror (errno)); "%s", g_strerror (errno));
return FALSE; return false;
} }
if (header->magic != SYSPROF_CAPTURE_MAGIC) if (header->magic != SYSPROF_CAPTURE_MAGIC)
@ -110,12 +110,12 @@ sysprof_capture_reader_read_file_header (SysprofCaptureReader *self,
G_FILE_ERROR, G_FILE_ERROR,
G_FILE_ERROR_FAILED, G_FILE_ERROR_FAILED,
"Capture file magic does not match"); "Capture file magic does not match");
return FALSE; return false;
} }
header->capture_time[sizeof header->capture_time - 1] = '\0'; header->capture_time[sizeof header->capture_time - 1] = '\0';
return TRUE; return true;
} }
static void static void
@ -349,7 +349,7 @@ sysprof_capture_reader_bswap_jitmap (SysprofCaptureReader *self,
jitmap->n_jitmaps = GUINT64_SWAP_LE_BE (jitmap->n_jitmaps); jitmap->n_jitmaps = GUINT64_SWAP_LE_BE (jitmap->n_jitmaps);
} }
static gboolean static bool
sysprof_capture_reader_ensure_space_for (SysprofCaptureReader *self, sysprof_capture_reader_ensure_space_for (SysprofCaptureReader *self,
size_t len) size_t len)
{ {
@ -391,7 +391,7 @@ sysprof_capture_reader_ensure_space_for (SysprofCaptureReader *self,
return (self->len - self->pos) >= len; return (self->len - self->pos) >= len;
} }
gboolean bool
sysprof_capture_reader_skip (SysprofCaptureReader *self) sysprof_capture_reader_skip (SysprofCaptureReader *self)
{ {
SysprofCaptureFrame *frame; SysprofCaptureFrame *frame;
@ -400,28 +400,28 @@ sysprof_capture_reader_skip (SysprofCaptureReader *self)
g_assert ((self->pos % SYSPROF_CAPTURE_ALIGN) == 0); g_assert ((self->pos % SYSPROF_CAPTURE_ALIGN) == 0);
if (!sysprof_capture_reader_ensure_space_for (self, sizeof (SysprofCaptureFrame))) if (!sysprof_capture_reader_ensure_space_for (self, sizeof (SysprofCaptureFrame)))
return FALSE; return false;
frame = (SysprofCaptureFrame *)(void *)&self->buf[self->pos]; frame = (SysprofCaptureFrame *)(void *)&self->buf[self->pos];
sysprof_capture_reader_bswap_frame (self, frame); sysprof_capture_reader_bswap_frame (self, frame);
if (frame->len < sizeof (SysprofCaptureFrame)) if (frame->len < sizeof (SysprofCaptureFrame))
return FALSE; return false;
if (!sysprof_capture_reader_ensure_space_for (self, frame->len)) if (!sysprof_capture_reader_ensure_space_for (self, frame->len))
return FALSE; return false;
frame = (SysprofCaptureFrame *)(void *)&self->buf[self->pos]; frame = (SysprofCaptureFrame *)(void *)&self->buf[self->pos];
self->pos += frame->len; self->pos += frame->len;
if ((self->pos % SYSPROF_CAPTURE_ALIGN) != 0) if ((self->pos % SYSPROF_CAPTURE_ALIGN) != 0)
return FALSE; return false;
return TRUE; return true;
} }
gboolean bool
sysprof_capture_reader_peek_frame (SysprofCaptureReader *self, sysprof_capture_reader_peek_frame (SysprofCaptureReader *self,
SysprofCaptureFrame *frame) SysprofCaptureFrame *frame)
{ {
@ -433,7 +433,7 @@ sysprof_capture_reader_peek_frame (SysprofCaptureReader *self,
g_assert (self->pos <= self->bufsz); g_assert (self->pos <= self->bufsz);
if (!sysprof_capture_reader_ensure_space_for (self, sizeof *real_frame)) if (!sysprof_capture_reader_ensure_space_for (self, sizeof *real_frame))
return FALSE; return false;
g_assert ((self->pos % SYSPROF_CAPTURE_ALIGN) == 0); 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; return frame->type > 0 && frame->type < SYSPROF_CAPTURE_FRAME_LAST;
} }
gboolean bool
sysprof_capture_reader_peek_type (SysprofCaptureReader *self, sysprof_capture_reader_peek_type (SysprofCaptureReader *self,
SysprofCaptureFrameType *type) SysprofCaptureFrameType *type)
{ {
@ -463,7 +463,7 @@ sysprof_capture_reader_peek_type (SysprofCaptureReader *self,
g_assert (type != NULL); g_assert (type != NULL);
if (!sysprof_capture_reader_peek_frame (self, &frame)) if (!sysprof_capture_reader_peek_frame (self, &frame))
return FALSE; return false;
*type = frame.type; *type = frame.type;
@ -953,7 +953,7 @@ sysprof_capture_reader_read_counter_set (SysprofCaptureReader *self)
return set; return set;
} }
gboolean bool
sysprof_capture_reader_reset (SysprofCaptureReader *self) sysprof_capture_reader_reset (SysprofCaptureReader *self)
{ {
g_assert (self != NULL); g_assert (self != NULL);
@ -962,7 +962,7 @@ sysprof_capture_reader_reset (SysprofCaptureReader *self)
self->pos = 0; self->pos = 0;
self->len = 0; self->len = 0;
return TRUE; return true;
} }
SysprofCaptureReader * SysprofCaptureReader *
@ -986,7 +986,7 @@ sysprof_capture_reader_unref (SysprofCaptureReader *self)
sysprof_capture_reader_finalize (self); sysprof_capture_reader_finalize (self);
} }
gboolean bool
sysprof_capture_reader_splice (SysprofCaptureReader *self, sysprof_capture_reader_splice (SysprofCaptureReader *self,
SysprofCaptureWriter *dest, SysprofCaptureWriter *dest,
GError **error) GError **error)
@ -1002,7 +1002,7 @@ sysprof_capture_reader_splice (SysprofCaptureReader *self,
G_FILE_ERROR, G_FILE_ERROR,
g_file_error_from_errno (errno), g_file_error_from_errno (errno),
"%s", g_strerror (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. * Returns: %TRUE on success; otherwise %FALSE and @error is set.
*/ */
gboolean bool
sysprof_capture_reader_save_as (SysprofCaptureReader *self, sysprof_capture_reader_save_as (SysprofCaptureReader *self,
const char *filename, const char *filename,
GError **error) GError **error)
@ -1075,7 +1075,7 @@ sysprof_capture_reader_save_as (SysprofCaptureReader *self,
close (fd); close (fd);
return TRUE; return true;
handle_errno: handle_errno:
if (fd != -1) if (fd != -1)
@ -1086,7 +1086,7 @@ handle_errno:
g_file_error_from_errno (errno), g_file_error_from_errno (errno),
"%s", g_strerror (errno)); "%s", g_strerror (errno));
return FALSE; return false;
} }
int64_t int64_t
@ -1180,16 +1180,16 @@ sysprof_capture_reader_set_stat (SysprofCaptureReader *self,
if (st_buf != NULL) if (st_buf != NULL)
{ {
self->st_buf = *st_buf; self->st_buf = *st_buf;
self->st_buf_set = TRUE; self->st_buf_set = true;
} }
else else
{ {
memset (&self->st_buf, 0, sizeof (self->st_buf)); 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, sysprof_capture_reader_get_stat (SysprofCaptureReader *self,
SysprofCaptureStat *st_buf) 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); return (char **)g_ptr_array_free (g_steal_pointer (&ar), FALSE);
} }
gboolean bool
sysprof_capture_reader_read_file_fd (SysprofCaptureReader *self, sysprof_capture_reader_read_file_fd (SysprofCaptureReader *self,
const char *path, const char *path,
int fd) int fd)
@ -1301,13 +1301,13 @@ sysprof_capture_reader_read_file_fd (SysprofCaptureReader *self,
size_t to_write; size_t to_write;
if (!sysprof_capture_reader_peek_type (self, &type)) if (!sysprof_capture_reader_peek_type (self, &type))
return FALSE; return false;
if (type != SYSPROF_CAPTURE_FRAME_FILE_CHUNK) if (type != SYSPROF_CAPTURE_FRAME_FILE_CHUNK)
goto skip; goto skip;
if (!(file = sysprof_capture_reader_read_file (self))) if (!(file = sysprof_capture_reader_read_file (self)))
return FALSE; return false;
if (g_strcmp0 (path, file->path) != 0) if (g_strcmp0 (path, file->path) != 0)
goto skip; goto skip;
@ -1321,10 +1321,10 @@ sysprof_capture_reader_read_file_fd (SysprofCaptureReader *self,
written = _sysprof_write (fd, buf, to_write); written = _sysprof_write (fd, buf, to_write);
if (written < 0) if (written < 0)
return FALSE; return false;
if (written == 0 && errno != EAGAIN) if (written == 0 && errno != EAGAIN)
return FALSE; return false;
g_assert (written <= (ssize_t)to_write); g_assert (written <= (ssize_t)to_write);
@ -1335,11 +1335,11 @@ sysprof_capture_reader_read_file_fd (SysprofCaptureReader *self,
if (!file->is_last) if (!file->is_last)
continue; continue;
return TRUE; return true;
skip: skip:
if (!sysprof_capture_reader_skip (self)) if (!sysprof_capture_reader_skip (self))
return FALSE; return false;
} }
g_return_val_if_reached (FALSE); g_return_val_if_reached (FALSE);

View File

@ -56,6 +56,8 @@
#pragma once #pragma once
#include <stdbool.h>
#include "sysprof-capture-types.h" #include "sysprof-capture-types.h"
#include "sysprof-version-macros.h" #include "sysprof-version-macros.h"
@ -86,12 +88,12 @@ int64_t sysprof_capture_reader_get_start_time (
SYSPROF_AVAILABLE_IN_ALL SYSPROF_AVAILABLE_IN_ALL
int64_t sysprof_capture_reader_get_end_time (SysprofCaptureReader *self); int64_t sysprof_capture_reader_get_end_time (SysprofCaptureReader *self);
SYSPROF_AVAILABLE_IN_ALL SYSPROF_AVAILABLE_IN_ALL
gboolean sysprof_capture_reader_skip (SysprofCaptureReader *self); bool sysprof_capture_reader_skip (SysprofCaptureReader *self);
SYSPROF_AVAILABLE_IN_ALL SYSPROF_AVAILABLE_IN_ALL
gboolean sysprof_capture_reader_peek_type (SysprofCaptureReader *self, bool sysprof_capture_reader_peek_type (SysprofCaptureReader *self,
SysprofCaptureFrameType *type); SysprofCaptureFrameType *type);
SYSPROF_AVAILABLE_IN_ALL SYSPROF_AVAILABLE_IN_ALL
gboolean sysprof_capture_reader_peek_frame (SysprofCaptureReader *self, bool sysprof_capture_reader_peek_frame (SysprofCaptureReader *self,
SysprofCaptureFrame *frame); SysprofCaptureFrame *frame);
SYSPROF_AVAILABLE_IN_ALL SYSPROF_AVAILABLE_IN_ALL
const SysprofCaptureLog *sysprof_capture_reader_read_log (SysprofCaptureReader *self); 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 SYSPROF_AVAILABLE_IN_3_36
const SysprofCaptureAllocation *sysprof_capture_reader_read_allocation (SysprofCaptureReader *self); const SysprofCaptureAllocation *sysprof_capture_reader_read_allocation (SysprofCaptureReader *self);
SYSPROF_AVAILABLE_IN_ALL SYSPROF_AVAILABLE_IN_ALL
gboolean sysprof_capture_reader_reset (SysprofCaptureReader *self); bool sysprof_capture_reader_reset (SysprofCaptureReader *self);
SYSPROF_AVAILABLE_IN_ALL SYSPROF_AVAILABLE_IN_ALL
gboolean sysprof_capture_reader_splice (SysprofCaptureReader *self, bool sysprof_capture_reader_splice (SysprofCaptureReader *self,
SysprofCaptureWriter *dest, SysprofCaptureWriter *dest,
GError **error); GError **error);
SYSPROF_AVAILABLE_IN_ALL SYSPROF_AVAILABLE_IN_ALL
gboolean sysprof_capture_reader_save_as (SysprofCaptureReader *self, bool sysprof_capture_reader_save_as (SysprofCaptureReader *self,
const char *filename, const char *filename,
GError **error); GError **error);
SYSPROF_AVAILABLE_IN_ALL SYSPROF_AVAILABLE_IN_ALL
gboolean sysprof_capture_reader_get_stat (SysprofCaptureReader *self, bool sysprof_capture_reader_get_stat (SysprofCaptureReader *self,
SysprofCaptureStat *st_buf); SysprofCaptureStat *st_buf);
SYSPROF_AVAILABLE_IN_ALL SYSPROF_AVAILABLE_IN_ALL
void sysprof_capture_reader_set_stat (SysprofCaptureReader *self, void sysprof_capture_reader_set_stat (SysprofCaptureReader *self,
@ -143,7 +145,7 @@ const SysprofCaptureFileChunk *sysprof_capture_reader_find_file (
SYSPROF_AVAILABLE_IN_ALL SYSPROF_AVAILABLE_IN_ALL
char **sysprof_capture_reader_list_files (SysprofCaptureReader *self); char **sysprof_capture_reader_list_files (SysprofCaptureReader *self);
SYSPROF_AVAILABLE_IN_ALL 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, const char *path,
int fd); int fd);

View File

@ -59,6 +59,7 @@
#include "config.h" #include "config.h"
#include <glib/gstdio.h> #include <glib/gstdio.h>
#include <stdbool.h>
#include <stdint.h> #include <stdint.h>
#include <stdlib.h> #include <stdlib.h>
#include <sysprof-capture.h> #include <sysprof-capture.h>
@ -146,7 +147,7 @@ translate_table_translate (GArray **tables,
return item != NULL ? item->dst : src; return item != NULL ? item->dst : src;
} }
gboolean bool
sysprof_capture_writer_cat (SysprofCaptureWriter *self, sysprof_capture_writer_cat (SysprofCaptureWriter *self,
SysprofCaptureReader *reader, SysprofCaptureReader *reader,
GError **error) GError **error)
@ -513,7 +514,7 @@ sysprof_capture_writer_cat (SysprofCaptureWriter *self,
translate_table_clear (tables, TRANSLATE_ADDR); translate_table_clear (tables, TRANSLATE_ADDR);
translate_table_clear (tables, TRANSLATE_CTR); translate_table_clear (tables, TRANSLATE_CTR);
return TRUE; return true;
panic: panic:
g_set_error (error, g_set_error (error,
@ -524,5 +525,5 @@ panic:
translate_table_clear (tables, TRANSLATE_ADDR); translate_table_clear (tables, TRANSLATE_ADDR);
translate_table_clear (tables, TRANSLATE_CTR); translate_table_clear (tables, TRANSLATE_CTR);
return FALSE; return false;
} }

View File

@ -205,7 +205,7 @@ sysprof_capture_writer_unref (SysprofCaptureWriter *self)
sysprof_capture_writer_finalize (self); sysprof_capture_writer_finalize (self);
} }
static gboolean static bool
sysprof_capture_writer_flush_data (SysprofCaptureWriter *self) sysprof_capture_writer_flush_data (SysprofCaptureWriter *self)
{ {
const uint8_t *buf; const uint8_t *buf;
@ -217,7 +217,7 @@ sysprof_capture_writer_flush_data (SysprofCaptureWriter *self)
g_assert ((self->pos % SYSPROF_CAPTURE_ALIGN) == 0); g_assert ((self->pos % SYSPROF_CAPTURE_ALIGN) == 0);
if (self->pos == 0) if (self->pos == 0)
return TRUE; return true;
buf = self->buf; buf = self->buf;
to_write = self->pos; to_write = self->pos;
@ -226,10 +226,10 @@ sysprof_capture_writer_flush_data (SysprofCaptureWriter *self)
{ {
written = _sysprof_write (self->fd, buf, to_write); written = _sysprof_write (self->fd, buf, to_write);
if (written < 0) if (written < 0)
return FALSE; return false;
if (written == 0 && errno != EAGAIN) if (written == 0 && errno != EAGAIN)
return FALSE; return false;
g_assert (written <= (ssize_t)to_write); g_assert (written <= (ssize_t)to_write);
@ -239,7 +239,7 @@ sysprof_capture_writer_flush_data (SysprofCaptureWriter *self)
self->pos = 0; self->pos = 0;
return TRUE; return true;
} }
static inline void static inline void
@ -248,21 +248,21 @@ sysprof_capture_writer_realign (size_t *pos)
*pos = (*pos + SYSPROF_CAPTURE_ALIGN - 1) & ~(SYSPROF_CAPTURE_ALIGN - 1); *pos = (*pos + SYSPROF_CAPTURE_ALIGN - 1) & ~(SYSPROF_CAPTURE_ALIGN - 1);
} }
static inline gboolean static inline bool
sysprof_capture_writer_ensure_space_for (SysprofCaptureWriter *self, sysprof_capture_writer_ensure_space_for (SysprofCaptureWriter *self,
size_t len) size_t len)
{ {
/* Check for max frame size */ /* Check for max frame size */
if (len > USHRT_MAX) if (len > USHRT_MAX)
return FALSE; return false;
if ((self->len - self->pos) < len) if ((self->len - self->pos) < len)
{ {
if (!sysprof_capture_writer_flush_data (self)) if (!sysprof_capture_writer_flush_data (self))
return FALSE; return false;
} }
return TRUE; return true;
} }
static inline void * static inline void *
@ -289,7 +289,7 @@ sysprof_capture_writer_allocate (SysprofCaptureWriter *self,
return p; return p;
} }
static gboolean static bool
sysprof_capture_writer_flush_jitmap (SysprofCaptureWriter *self) sysprof_capture_writer_flush_jitmap (SysprofCaptureWriter *self)
{ {
SysprofCaptureJitmap jitmap; SysprofCaptureJitmap jitmap;
@ -299,7 +299,7 @@ sysprof_capture_writer_flush_jitmap (SysprofCaptureWriter *self)
g_assert (self != NULL); g_assert (self != NULL);
if (self->addr_hash_size == 0) if (self->addr_hash_size == 0)
return TRUE; return true;
g_assert (self->addr_buf_pos > 0); 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; jitmap.n_jitmaps = self->addr_hash_size;
if (sizeof jitmap != _sysprof_write (self->fd, &jitmap, sizeof jitmap)) 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); r = _sysprof_write (self->fd, self->addr_buf, len - sizeof jitmap);
if (r < 0 || (size_t)r != (len - sizeof jitmap)) if (r < 0 || (size_t)r != (len - sizeof jitmap))
return FALSE; return false;
self->addr_buf_pos = 0; self->addr_buf_pos = 0;
self->addr_hash_size = 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]++; self->stat.frame_count[SYSPROF_CAPTURE_FRAME_JITMAP]++;
return TRUE; return true;
} }
static gboolean static bool
sysprof_capture_writer_lookup_jitmap (SysprofCaptureWriter *self, sysprof_capture_writer_lookup_jitmap (SysprofCaptureWriter *self,
const char *name, const char *name,
SysprofCaptureAddress *addr) SysprofCaptureAddress *addr)
@ -350,12 +350,12 @@ sysprof_capture_writer_lookup_jitmap (SysprofCaptureWriter *self,
SysprofCaptureJitmapBucket *bucket = &self->addr_hash[i]; SysprofCaptureJitmapBucket *bucket = &self->addr_hash[i];
if (bucket->str == NULL) if (bucket->str == NULL)
return FALSE; return false;
if (strcmp (bucket->str, name) == 0) if (strcmp (bucket->str, name) == 0)
{ {
*addr = bucket->addr; *addr = bucket->addr;
return TRUE; return true;
} }
} }
@ -364,16 +364,16 @@ sysprof_capture_writer_lookup_jitmap (SysprofCaptureWriter *self,
SysprofCaptureJitmapBucket *bucket = &self->addr_hash[i]; SysprofCaptureJitmapBucket *bucket = &self->addr_hash[i];
if (bucket->str == NULL) if (bucket->str == NULL)
return FALSE; return false;
if (strcmp (bucket->str, name) == 0) if (strcmp (bucket->str, name) == 0)
{ {
*addr = bucket->addr; *addr = bucket->addr;
return TRUE; return true;
} }
} }
return FALSE; return false;
} }
static SysprofCaptureAddress static SysprofCaptureAddress
@ -512,9 +512,9 @@ sysprof_capture_writer_new_from_fd (int fd,
header->magic = SYSPROF_CAPTURE_MAGIC; header->magic = SYSPROF_CAPTURE_MAGIC;
header->version = 1; header->version = 1;
#if G_BYTE_ORDER == G_LITTLE_ENDIAN #if G_BYTE_ORDER == G_LITTLE_ENDIAN
header->little_endian = TRUE; header->little_endian = true;
#else #else
header->little_endian = FALSE; header->little_endian = false;
#endif #endif
header->padding = 0; header->padding = 0;
g_strlcpy (header->capture_time, nowstr, sizeof header->capture_time); g_strlcpy (header->capture_time, nowstr, sizeof header->capture_time);
@ -560,7 +560,7 @@ sysprof_capture_writer_new (const char *filename,
return self; return self;
} }
gboolean bool
sysprof_capture_writer_add_map (SysprofCaptureWriter *self, sysprof_capture_writer_add_map (SysprofCaptureWriter *self,
int64_t time, int64_t time,
int cpu, int cpu,
@ -584,7 +584,7 @@ sysprof_capture_writer_add_map (SysprofCaptureWriter *self,
ev = (SysprofCaptureMap *)sysprof_capture_writer_allocate (self, &len); ev = (SysprofCaptureMap *)sysprof_capture_writer_allocate (self, &len);
if (!ev) if (!ev)
return FALSE; return false;
sysprof_capture_writer_frame_init (&ev->frame, sysprof_capture_writer_frame_init (&ev->frame,
len, len,
@ -602,10 +602,10 @@ sysprof_capture_writer_add_map (SysprofCaptureWriter *self,
self->stat.frame_count[SYSPROF_CAPTURE_FRAME_MAP]++; self->stat.frame_count[SYSPROF_CAPTURE_FRAME_MAP]++;
return TRUE; return true;
} }
gboolean bool
sysprof_capture_writer_add_mark (SysprofCaptureWriter *self, sysprof_capture_writer_add_mark (SysprofCaptureWriter *self,
int64_t time, int64_t time,
int cpu, int cpu,
@ -630,7 +630,7 @@ sysprof_capture_writer_add_mark (SysprofCaptureWriter *self,
len = sizeof *ev + message_len; len = sizeof *ev + message_len;
ev = (SysprofCaptureMark *)sysprof_capture_writer_allocate (self, &len); ev = (SysprofCaptureMark *)sysprof_capture_writer_allocate (self, &len);
if (!ev) if (!ev)
return FALSE; return false;
sysprof_capture_writer_frame_init (&ev->frame, sysprof_capture_writer_frame_init (&ev->frame,
len, len,
@ -646,10 +646,10 @@ sysprof_capture_writer_add_mark (SysprofCaptureWriter *self,
self->stat.frame_count[SYSPROF_CAPTURE_FRAME_MARK]++; self->stat.frame_count[SYSPROF_CAPTURE_FRAME_MARK]++;
return TRUE; return true;
} }
gboolean bool
sysprof_capture_writer_add_metadata (SysprofCaptureWriter *self, sysprof_capture_writer_add_metadata (SysprofCaptureWriter *self,
int64_t time, int64_t time,
int cpu, int cpu,
@ -676,7 +676,7 @@ sysprof_capture_writer_add_metadata (SysprofCaptureWriter *self,
len = sizeof *ev + metadata_len + 1; len = sizeof *ev + metadata_len + 1;
ev = (SysprofCaptureMetadata *)sysprof_capture_writer_allocate (self, &len); ev = (SysprofCaptureMetadata *)sysprof_capture_writer_allocate (self, &len);
if (!ev) if (!ev)
return FALSE; return false;
sysprof_capture_writer_frame_init (&ev->frame, sysprof_capture_writer_frame_init (&ev->frame,
len, len,
@ -691,7 +691,7 @@ sysprof_capture_writer_add_metadata (SysprofCaptureWriter *self,
self->stat.frame_count[SYSPROF_CAPTURE_FRAME_METADATA]++; self->stat.frame_count[SYSPROF_CAPTURE_FRAME_METADATA]++;
return TRUE; return true;
} }
SysprofCaptureAddress SysprofCaptureAddress
@ -712,7 +712,7 @@ sysprof_capture_writer_add_jitmap (SysprofCaptureWriter *self,
return addr; return addr;
} }
gboolean bool
sysprof_capture_writer_add_process (SysprofCaptureWriter *self, sysprof_capture_writer_add_process (SysprofCaptureWriter *self,
int64_t time, int64_t time,
int cpu, int cpu,
@ -732,7 +732,7 @@ sysprof_capture_writer_add_process (SysprofCaptureWriter *self,
ev = (SysprofCaptureProcess *)sysprof_capture_writer_allocate (self, &len); ev = (SysprofCaptureProcess *)sysprof_capture_writer_allocate (self, &len);
if (!ev) if (!ev)
return FALSE; return false;
sysprof_capture_writer_frame_init (&ev->frame, sysprof_capture_writer_frame_init (&ev->frame,
len, len,
@ -746,10 +746,10 @@ sysprof_capture_writer_add_process (SysprofCaptureWriter *self,
self->stat.frame_count[SYSPROF_CAPTURE_FRAME_PROCESS]++; self->stat.frame_count[SYSPROF_CAPTURE_FRAME_PROCESS]++;
return TRUE; return true;
} }
gboolean bool
sysprof_capture_writer_add_sample (SysprofCaptureWriter *self, sysprof_capture_writer_add_sample (SysprofCaptureWriter *self,
int64_t time, int64_t time,
int cpu, int cpu,
@ -767,7 +767,7 @@ sysprof_capture_writer_add_sample (SysprofCaptureWriter *self,
ev = (SysprofCaptureSample *)sysprof_capture_writer_allocate (self, &len); ev = (SysprofCaptureSample *)sysprof_capture_writer_allocate (self, &len);
if (!ev) if (!ev)
return FALSE; return false;
sysprof_capture_writer_frame_init (&ev->frame, sysprof_capture_writer_frame_init (&ev->frame,
len, len,
@ -782,10 +782,10 @@ sysprof_capture_writer_add_sample (SysprofCaptureWriter *self,
self->stat.frame_count[SYSPROF_CAPTURE_FRAME_SAMPLE]++; self->stat.frame_count[SYSPROF_CAPTURE_FRAME_SAMPLE]++;
return TRUE; return true;
} }
gboolean bool
sysprof_capture_writer_add_fork (SysprofCaptureWriter *self, sysprof_capture_writer_add_fork (SysprofCaptureWriter *self,
int64_t time, int64_t time,
int cpu, int cpu,
@ -799,7 +799,7 @@ sysprof_capture_writer_add_fork (SysprofCaptureWriter *self,
ev = (SysprofCaptureFork *)sysprof_capture_writer_allocate (self, &len); ev = (SysprofCaptureFork *)sysprof_capture_writer_allocate (self, &len);
if (!ev) if (!ev)
return FALSE; return false;
sysprof_capture_writer_frame_init (&ev->frame, sysprof_capture_writer_frame_init (&ev->frame,
len, len,
@ -811,10 +811,10 @@ sysprof_capture_writer_add_fork (SysprofCaptureWriter *self,
self->stat.frame_count[SYSPROF_CAPTURE_FRAME_FORK]++; self->stat.frame_count[SYSPROF_CAPTURE_FRAME_FORK]++;
return TRUE; return true;
} }
gboolean bool
sysprof_capture_writer_add_exit (SysprofCaptureWriter *self, sysprof_capture_writer_add_exit (SysprofCaptureWriter *self,
int64_t time, int64_t time,
int cpu, int cpu,
@ -827,7 +827,7 @@ sysprof_capture_writer_add_exit (SysprofCaptureWriter *self,
ev = (SysprofCaptureExit *)sysprof_capture_writer_allocate (self, &len); ev = (SysprofCaptureExit *)sysprof_capture_writer_allocate (self, &len);
if (!ev) if (!ev)
return FALSE; return false;
sysprof_capture_writer_frame_init (&ev->frame, sysprof_capture_writer_frame_init (&ev->frame,
len, len,
@ -838,10 +838,10 @@ sysprof_capture_writer_add_exit (SysprofCaptureWriter *self,
self->stat.frame_count[SYSPROF_CAPTURE_FRAME_EXIT]++; self->stat.frame_count[SYSPROF_CAPTURE_FRAME_EXIT]++;
return TRUE; return true;
} }
gboolean bool
sysprof_capture_writer_add_timestamp (SysprofCaptureWriter *self, sysprof_capture_writer_add_timestamp (SysprofCaptureWriter *self,
int64_t time, int64_t time,
int cpu, int cpu,
@ -854,7 +854,7 @@ sysprof_capture_writer_add_timestamp (SysprofCaptureWriter *self,
ev = (SysprofCaptureTimestamp *)sysprof_capture_writer_allocate (self, &len); ev = (SysprofCaptureTimestamp *)sysprof_capture_writer_allocate (self, &len);
if (!ev) if (!ev)
return FALSE; return false;
sysprof_capture_writer_frame_init (&ev->frame, sysprof_capture_writer_frame_init (&ev->frame,
len, len,
@ -865,10 +865,10 @@ sysprof_capture_writer_add_timestamp (SysprofCaptureWriter *self,
self->stat.frame_count[SYSPROF_CAPTURE_FRAME_TIMESTAMP]++; self->stat.frame_count[SYSPROF_CAPTURE_FRAME_TIMESTAMP]++;
return TRUE; return true;
} }
static gboolean static bool
sysprof_capture_writer_flush_end_time (SysprofCaptureWriter *self) sysprof_capture_writer_flush_end_time (SysprofCaptureWriter *self)
{ {
int64_t end_time = SYSPROF_CAPTURE_CURRENT_TIME; int64_t end_time = SYSPROF_CAPTURE_CURRENT_TIME;
@ -887,10 +887,10 @@ again:
if (ret < 0 && errno == EAGAIN) if (ret < 0 && errno == EAGAIN)
goto again; goto again;
return TRUE; return true;
} }
gboolean bool
sysprof_capture_writer_flush (SysprofCaptureWriter *self) sysprof_capture_writer_flush (SysprofCaptureWriter *self)
{ {
g_assert (self != NULL); g_assert (self != NULL);
@ -913,7 +913,7 @@ sysprof_capture_writer_flush (SysprofCaptureWriter *self)
* *
* Returns: %TRUE if successful, otherwise %FALSE and @error is set. * Returns: %TRUE if successful, otherwise %FALSE and @error is set.
*/ */
gboolean bool
sysprof_capture_writer_save_as (SysprofCaptureWriter *self, sysprof_capture_writer_save_as (SysprofCaptureWriter *self,
const char *filename, const char *filename,
GError **error) GError **error)
@ -958,7 +958,7 @@ sysprof_capture_writer_save_as (SysprofCaptureWriter *self,
close (fd); close (fd);
return TRUE; return true;
handle_errno: handle_errno:
g_set_error (error, g_set_error (error,
@ -972,7 +972,7 @@ handle_errno:
g_unlink (filename); g_unlink (filename);
} }
return FALSE; return false;
} }
/** /**
@ -991,7 +991,7 @@ handle_errno:
* *
* Returns: %TRUE if successful; otherwise %FALSE and @error is set. * Returns: %TRUE if successful; otherwise %FALSE and @error is set.
*/ */
gboolean bool
_sysprof_capture_writer_splice_from_fd (SysprofCaptureWriter *self, _sysprof_capture_writer_splice_from_fd (SysprofCaptureWriter *self,
int fd, int fd,
GError **error) GError **error)
@ -1012,7 +1012,7 @@ _sysprof_capture_writer_splice_from_fd (SysprofCaptureWriter *self,
G_FILE_ERROR, G_FILE_ERROR,
G_FILE_ERROR_INVAL, G_FILE_ERROR_INVAL,
"Cannot splice, possibly corrupt file."); "Cannot splice, possibly corrupt file.");
return FALSE; return false;
} }
in_off = 256; in_off = 256;
@ -1035,7 +1035,7 @@ _sysprof_capture_writer_splice_from_fd (SysprofCaptureWriter *self,
to_write -= written; to_write -= written;
} }
return TRUE; return true;
handle_errno: handle_errno:
g_set_error (error, g_set_error (error,
@ -1043,7 +1043,7 @@ handle_errno:
g_file_error_from_errno (errno), g_file_error_from_errno (errno),
"%s", g_strerror (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. * Returns: %TRUE if successful, otherwise %FALSE and and @error is set.
*/ */
gboolean bool
sysprof_capture_writer_splice (SysprofCaptureWriter *self, sysprof_capture_writer_splice (SysprofCaptureWriter *self,
SysprofCaptureWriter *dest, SysprofCaptureWriter *dest,
GError **error) GError **error)
{ {
gboolean ret; bool ret;
off_t pos; off_t pos;
g_assert (self != NULL); 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 */ /* Now reset or file-descriptor position (it should be the same */
if (pos != lseek (self->fd, pos, SEEK_SET)) if (pos != lseek (self->fd, pos, SEEK_SET))
{ {
ret = FALSE; ret = false;
goto handle_errno; goto handle_errno;
} }
@ -1098,7 +1098,7 @@ handle_errno:
g_file_error_from_errno (errno), g_file_error_from_errno (errno),
"%s", g_strerror (errno)); "%s", g_strerror (errno));
return FALSE; return false;
} }
/** /**
@ -1165,7 +1165,7 @@ sysprof_capture_writer_stat (SysprofCaptureWriter *self,
*stat = self->stat; *stat = self->stat;
} }
gboolean bool
sysprof_capture_writer_define_counters (SysprofCaptureWriter *self, sysprof_capture_writer_define_counters (SysprofCaptureWriter *self,
int64_t time, int64_t time,
int cpu, int cpu,
@ -1181,13 +1181,13 @@ sysprof_capture_writer_define_counters (SysprofCaptureWriter *self,
g_assert (counters != NULL); g_assert (counters != NULL);
if (n_counters == 0) if (n_counters == 0)
return TRUE; return true;
len = sizeof *def + (sizeof *counters * n_counters); len = sizeof *def + (sizeof *counters * n_counters);
def = (SysprofCaptureCounterDefine *)sysprof_capture_writer_allocate (self, &len); def = (SysprofCaptureCounterDefine *)sysprof_capture_writer_allocate (self, &len);
if (!def) if (!def)
return FALSE; return false;
sysprof_capture_writer_frame_init (&def->frame, sysprof_capture_writer_frame_init (&def->frame,
len, len,
@ -1212,10 +1212,10 @@ sysprof_capture_writer_define_counters (SysprofCaptureWriter *self,
self->stat.frame_count[SYSPROF_CAPTURE_FRAME_CTRDEF]++; self->stat.frame_count[SYSPROF_CAPTURE_FRAME_CTRDEF]++;
return TRUE; return true;
} }
gboolean bool
sysprof_capture_writer_set_counters (SysprofCaptureWriter *self, sysprof_capture_writer_set_counters (SysprofCaptureWriter *self,
int64_t time, int64_t time,
int cpu, int cpu,
@ -1236,7 +1236,7 @@ sysprof_capture_writer_set_counters (SysprofCaptureWriter *self,
g_assert (values != NULL || !n_counters); g_assert (values != NULL || !n_counters);
if (n_counters == 0) if (n_counters == 0)
return TRUE; return true;
/* Determine how many value groups we need */ /* Determine how many value groups we need */
n_groups = n_counters / G_N_ELEMENTS (set->values[0].values); 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); set = (SysprofCaptureCounterSet *)sysprof_capture_writer_allocate (self, &len);
if (!set) if (!set)
return FALSE; return false;
memset (set, 0, len); memset (set, 0, len);
@ -1277,7 +1277,7 @@ sysprof_capture_writer_set_counters (SysprofCaptureWriter *self,
self->stat.frame_count[SYSPROF_CAPTURE_FRAME_CTRSET]++; 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; return ret;
} }
gboolean bool
_sysprof_capture_writer_set_time_range (SysprofCaptureWriter *self, _sysprof_capture_writer_set_time_range (SysprofCaptureWriter *self,
int64_t start_time, int64_t start_time,
int64_t end_time) int64_t end_time)
@ -1337,7 +1337,7 @@ do_end:
if (ret < 0 && errno == EAGAIN) if (ret < 0 && errno == EAGAIN)
goto do_end; goto do_end;
return TRUE; return true;
} }
SysprofCaptureWriter * SysprofCaptureWriter *
@ -1370,7 +1370,7 @@ sysprof_capture_writer_get_buffer_size (SysprofCaptureWriter *self)
return self->len; return self->len;
} }
gboolean bool
sysprof_capture_writer_add_log (SysprofCaptureWriter *self, sysprof_capture_writer_add_log (SysprofCaptureWriter *self,
int64_t time, int64_t time,
int cpu, int cpu,
@ -1395,7 +1395,7 @@ sysprof_capture_writer_add_log (SysprofCaptureWriter *self,
len = sizeof *ev + message_len; len = sizeof *ev + message_len;
ev = (SysprofCaptureLog *)sysprof_capture_writer_allocate (self, &len); ev = (SysprofCaptureLog *)sysprof_capture_writer_allocate (self, &len);
if (!ev) if (!ev)
return FALSE; return false;
sysprof_capture_writer_frame_init (&ev->frame, sysprof_capture_writer_frame_init (&ev->frame,
len, len,
@ -1412,10 +1412,10 @@ sysprof_capture_writer_add_log (SysprofCaptureWriter *self,
self->stat.frame_count[SYSPROF_CAPTURE_FRAME_LOG]++; self->stat.frame_count[SYSPROF_CAPTURE_FRAME_LOG]++;
return TRUE; return true;
} }
gboolean bool
sysprof_capture_writer_add_file (SysprofCaptureWriter *self, sysprof_capture_writer_add_file (SysprofCaptureWriter *self,
int64_t time, int64_t time,
int cpu, int cpu,
@ -1433,7 +1433,7 @@ sysprof_capture_writer_add_file (SysprofCaptureWriter *self,
len = sizeof *ev + data_len; len = sizeof *ev + data_len;
ev = (SysprofCaptureFileChunk *)sysprof_capture_writer_allocate (self, &len); ev = (SysprofCaptureFileChunk *)sysprof_capture_writer_allocate (self, &len);
if (!ev) if (!ev)
return FALSE; return false;
sysprof_capture_writer_frame_init (&ev->frame, sysprof_capture_writer_frame_init (&ev->frame,
len, len,
@ -1450,10 +1450,10 @@ sysprof_capture_writer_add_file (SysprofCaptureWriter *self,
self->stat.frame_count[SYSPROF_CAPTURE_FRAME_FILE_CHUNK]++; self->stat.frame_count[SYSPROF_CAPTURE_FRAME_FILE_CHUNK]++;
return TRUE; return true;
} }
gboolean bool
sysprof_capture_writer_add_file_fd (SysprofCaptureWriter *self, sysprof_capture_writer_add_file_fd (SysprofCaptureWriter *self,
int64_t time, int64_t time,
int cpu, int cpu,
@ -1467,7 +1467,7 @@ sysprof_capture_writer_add_file_fd (SysprofCaptureWriter *self,
for (;;) for (;;)
{ {
gboolean is_last; bool is_last;
ssize_t n_read; ssize_t n_read;
again: again:
@ -1478,13 +1478,13 @@ sysprof_capture_writer_add_file_fd (SysprofCaptureWriter *self,
is_last = n_read == 0; is_last = n_read == 0;
if (!sysprof_capture_writer_add_file (self, time, cpu, pid, path, is_last, data, n_read)) if (!sysprof_capture_writer_add_file (self, time, cpu, pid, path, is_last, data, n_read))
return FALSE; return false;
if (is_last) if (is_last)
break; break;
} }
return TRUE; return true;
} }
static gboolean static gboolean
@ -1523,7 +1523,7 @@ sysprof_capture_writer_set_flush_delay (SysprofCaptureWriter *self,
g_source_attach (self->periodic_flush, main_context); g_source_attach (self->periodic_flush, main_context);
} }
gboolean bool
sysprof_capture_writer_add_allocation (SysprofCaptureWriter *self, sysprof_capture_writer_add_allocation (SysprofCaptureWriter *self,
int64_t time, int64_t time,
int cpu, int cpu,
@ -1544,7 +1544,7 @@ sysprof_capture_writer_add_allocation (SysprofCaptureWriter *self,
len = sizeof *ev + (MAX_UNWIND_DEPTH * sizeof (SysprofCaptureAddress)); len = sizeof *ev + (MAX_UNWIND_DEPTH * sizeof (SysprofCaptureAddress));
ev = (SysprofCaptureAllocation *)sysprof_capture_writer_allocate (self, &len); ev = (SysprofCaptureAllocation *)sysprof_capture_writer_allocate (self, &len);
if (!ev) if (!ev)
return FALSE; return false;
sysprof_capture_writer_frame_init (&ev->frame, sysprof_capture_writer_frame_init (&ev->frame,
len, len,
@ -1574,10 +1574,10 @@ sysprof_capture_writer_add_allocation (SysprofCaptureWriter *self,
self->stat.frame_count[SYSPROF_CAPTURE_FRAME_ALLOCATION]++; self->stat.frame_count[SYSPROF_CAPTURE_FRAME_ALLOCATION]++;
return TRUE; return true;
} }
gboolean bool
sysprof_capture_writer_add_allocation_copy (SysprofCaptureWriter *self, sysprof_capture_writer_add_allocation_copy (SysprofCaptureWriter *self,
int64_t time, int64_t time,
int cpu, int cpu,
@ -1599,7 +1599,7 @@ sysprof_capture_writer_add_allocation_copy (SysprofCaptureWriter *self,
len = sizeof *ev + (n_addrs * sizeof (SysprofCaptureAddress)); len = sizeof *ev + (n_addrs * sizeof (SysprofCaptureAddress));
ev = (SysprofCaptureAllocation *)sysprof_capture_writer_allocate (self, &len); ev = (SysprofCaptureAllocation *)sysprof_capture_writer_allocate (self, &len);
if (!ev) if (!ev)
return FALSE; return false;
sysprof_capture_writer_frame_init (&ev->frame, sysprof_capture_writer_frame_init (&ev->frame,
len, len,
@ -1618,10 +1618,10 @@ sysprof_capture_writer_add_allocation_copy (SysprofCaptureWriter *self,
self->stat.frame_count[SYSPROF_CAPTURE_FRAME_ALLOCATION]++; self->stat.frame_count[SYSPROF_CAPTURE_FRAME_ALLOCATION]++;
return TRUE; return true;
} }
gboolean bool
_sysprof_capture_writer_add_raw (SysprofCaptureWriter *self, _sysprof_capture_writer_add_raw (SysprofCaptureWriter *self,
const SysprofCaptureFrame *fr) const SysprofCaptureFrame *fr)
{ {
@ -1635,7 +1635,7 @@ _sysprof_capture_writer_add_raw (SysprofCaptureWriter *self,
len = fr->len; len = fr->len;
if (!(begin = sysprof_capture_writer_allocate (self, &len))) if (!(begin = sysprof_capture_writer_allocate (self, &len)))
return FALSE; return false;
g_assert (fr->len == len); g_assert (fr->len == len);
g_assert (fr->type < 16); 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)) if (fr->type < G_N_ELEMENTS (self->stat.frame_count))
self->stat.frame_count[fr->type]++; self->stat.frame_count[fr->type]++;
return TRUE; return true;
} }

View File

@ -56,6 +56,7 @@
#pragma once #pragma once
#include <stdbool.h>
#include <stdint.h> #include <stdint.h>
#include <sys/types.h> #include <sys/types.h>
@ -101,23 +102,23 @@ void sysprof_capture_writer_set_flush_delay (Sy
GMainContext *main_context, GMainContext *main_context,
unsigned int timeout_seconds); unsigned int timeout_seconds);
SYSPROF_AVAILABLE_IN_ALL SYSPROF_AVAILABLE_IN_ALL
gboolean sysprof_capture_writer_add_file (SysprofCaptureWriter *self, bool sysprof_capture_writer_add_file (SysprofCaptureWriter *self,
int64_t time, int64_t time,
int cpu, int cpu,
int32_t pid, int32_t pid,
const char *path, const char *path,
gboolean is_last, bool is_last,
const uint8_t *data, const uint8_t *data,
size_t data_len); size_t data_len);
SYSPROF_AVAILABLE_IN_ALL 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, int64_t time,
int cpu, int cpu,
int32_t pid, int32_t pid,
const char *path, const char *path,
int fd); int fd);
SYSPROF_AVAILABLE_IN_ALL SYSPROF_AVAILABLE_IN_ALL
gboolean sysprof_capture_writer_add_map (SysprofCaptureWriter *self, bool sysprof_capture_writer_add_map (SysprofCaptureWriter *self,
int64_t time, int64_t time,
int cpu, int cpu,
int32_t pid, int32_t pid,
@ -127,7 +128,7 @@ gboolean sysprof_capture_writer_add_map (Sy
uint64_t inode, uint64_t inode,
const char *filename); const char *filename);
SYSPROF_AVAILABLE_IN_ALL SYSPROF_AVAILABLE_IN_ALL
gboolean sysprof_capture_writer_add_mark (SysprofCaptureWriter *self, bool sysprof_capture_writer_add_mark (SysprofCaptureWriter *self,
int64_t time, int64_t time,
int cpu, int cpu,
int32_t pid, int32_t pid,
@ -136,7 +137,7 @@ gboolean sysprof_capture_writer_add_mark (Sy
const char *name, const char *name,
const char *message); const char *message);
SYSPROF_AVAILABLE_IN_ALL SYSPROF_AVAILABLE_IN_ALL
gboolean sysprof_capture_writer_add_metadata (SysprofCaptureWriter *self, bool sysprof_capture_writer_add_metadata (SysprofCaptureWriter *self,
int64_t time, int64_t time,
int cpu, int cpu,
int32_t pid, int32_t pid,
@ -147,13 +148,13 @@ SYSPROF_AVAILABLE_IN_ALL
uint64_t sysprof_capture_writer_add_jitmap (SysprofCaptureWriter *self, uint64_t sysprof_capture_writer_add_jitmap (SysprofCaptureWriter *self,
const char *name); const char *name);
SYSPROF_AVAILABLE_IN_ALL SYSPROF_AVAILABLE_IN_ALL
gboolean sysprof_capture_writer_add_process (SysprofCaptureWriter *self, bool sysprof_capture_writer_add_process (SysprofCaptureWriter *self,
int64_t time, int64_t time,
int cpu, int cpu,
int32_t pid, int32_t pid,
const char *cmdline); const char *cmdline);
SYSPROF_AVAILABLE_IN_ALL SYSPROF_AVAILABLE_IN_ALL
gboolean sysprof_capture_writer_add_sample (SysprofCaptureWriter *self, bool sysprof_capture_writer_add_sample (SysprofCaptureWriter *self,
int64_t time, int64_t time,
int cpu, int cpu,
int32_t pid, int32_t pid,
@ -161,30 +162,30 @@ gboolean sysprof_capture_writer_add_sample (Sy
const SysprofCaptureAddress *addrs, const SysprofCaptureAddress *addrs,
unsigned int n_addrs); unsigned int n_addrs);
SYSPROF_AVAILABLE_IN_ALL SYSPROF_AVAILABLE_IN_ALL
gboolean sysprof_capture_writer_add_fork (SysprofCaptureWriter *self, bool sysprof_capture_writer_add_fork (SysprofCaptureWriter *self,
int64_t time, int64_t time,
int cpu, int cpu,
int32_t pid, int32_t pid,
int32_t child_pid); int32_t child_pid);
SYSPROF_AVAILABLE_IN_ALL SYSPROF_AVAILABLE_IN_ALL
gboolean sysprof_capture_writer_add_exit (SysprofCaptureWriter *self, bool sysprof_capture_writer_add_exit (SysprofCaptureWriter *self,
int64_t time, int64_t time,
int cpu, int cpu,
int32_t pid); int32_t pid);
SYSPROF_AVAILABLE_IN_ALL SYSPROF_AVAILABLE_IN_ALL
gboolean sysprof_capture_writer_add_timestamp (SysprofCaptureWriter *self, bool sysprof_capture_writer_add_timestamp (SysprofCaptureWriter *self,
int64_t time, int64_t time,
int cpu, int cpu,
int32_t pid); int32_t pid);
SYSPROF_AVAILABLE_IN_ALL SYSPROF_AVAILABLE_IN_ALL
gboolean sysprof_capture_writer_define_counters (SysprofCaptureWriter *self, bool sysprof_capture_writer_define_counters (SysprofCaptureWriter *self,
int64_t time, int64_t time,
int cpu, int cpu,
int32_t pid, int32_t pid,
const SysprofCaptureCounter *counters, const SysprofCaptureCounter *counters,
unsigned int n_counters); unsigned int n_counters);
SYSPROF_AVAILABLE_IN_ALL SYSPROF_AVAILABLE_IN_ALL
gboolean sysprof_capture_writer_set_counters (SysprofCaptureWriter *self, bool sysprof_capture_writer_set_counters (SysprofCaptureWriter *self,
int64_t time, int64_t time,
int cpu, int cpu,
int32_t pid, int32_t pid,
@ -192,7 +193,7 @@ gboolean sysprof_capture_writer_set_counters (Sy
const SysprofCaptureCounterValue *values, const SysprofCaptureCounterValue *values,
unsigned int n_counters); unsigned int n_counters);
SYSPROF_AVAILABLE_IN_ALL SYSPROF_AVAILABLE_IN_ALL
gboolean sysprof_capture_writer_add_log (SysprofCaptureWriter *self, bool sysprof_capture_writer_add_log (SysprofCaptureWriter *self,
int64_t time, int64_t time,
int cpu, int cpu,
int32_t pid, int32_t pid,
@ -200,7 +201,7 @@ gboolean sysprof_capture_writer_add_log (Sy
const char *domain, const char *domain,
const char *message); const char *message);
SYSPROF_AVAILABLE_IN_3_36 SYSPROF_AVAILABLE_IN_3_36
gboolean sysprof_capture_writer_add_allocation (SysprofCaptureWriter *self, bool sysprof_capture_writer_add_allocation (SysprofCaptureWriter *self,
int64_t time, int64_t time,
int cpu, int cpu,
int32_t pid, int32_t pid,
@ -210,7 +211,7 @@ gboolean sysprof_capture_writer_add_allocation (Sy
SysprofBacktraceFunc backtrace_func, SysprofBacktraceFunc backtrace_func,
void *backtrace_data); void *backtrace_data);
SYSPROF_AVAILABLE_IN_3_36 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, int64_t time,
int cpu, int cpu,
int32_t pid, int32_t pid,
@ -220,9 +221,9 @@ gboolean sysprof_capture_writer_add_allocation_copy (Sy
const SysprofCaptureAddress *addrs, const SysprofCaptureAddress *addrs,
unsigned int n_addrs); unsigned int n_addrs);
SYSPROF_AVAILABLE_IN_ALL SYSPROF_AVAILABLE_IN_ALL
gboolean sysprof_capture_writer_flush (SysprofCaptureWriter *self); bool sysprof_capture_writer_flush (SysprofCaptureWriter *self);
SYSPROF_AVAILABLE_IN_ALL SYSPROF_AVAILABLE_IN_ALL
gboolean sysprof_capture_writer_save_as (SysprofCaptureWriter *self, bool sysprof_capture_writer_save_as (SysprofCaptureWriter *self,
const char *filename, const char *filename,
GError **error); GError **error);
SYSPROF_AVAILABLE_IN_ALL SYSPROF_AVAILABLE_IN_ALL
@ -232,22 +233,22 @@ SYSPROF_AVAILABLE_IN_ALL
SysprofCaptureReader *sysprof_capture_writer_create_reader (SysprofCaptureWriter *self, SysprofCaptureReader *sysprof_capture_writer_create_reader (SysprofCaptureWriter *self,
GError **error); GError **error);
SYSPROF_AVAILABLE_IN_ALL SYSPROF_AVAILABLE_IN_ALL
gboolean sysprof_capture_writer_splice (SysprofCaptureWriter *self, bool sysprof_capture_writer_splice (SysprofCaptureWriter *self,
SysprofCaptureWriter *dest, SysprofCaptureWriter *dest,
GError **error); GError **error);
SYSPROF_AVAILABLE_IN_ALL SYSPROF_AVAILABLE_IN_ALL
gboolean sysprof_capture_writer_cat (SysprofCaptureWriter *self, bool sysprof_capture_writer_cat (SysprofCaptureWriter *self,
SysprofCaptureReader *reader, SysprofCaptureReader *reader,
GError **error); GError **error);
G_GNUC_INTERNAL G_GNUC_INTERNAL
gboolean _sysprof_capture_writer_add_raw (SysprofCaptureWriter *self, bool _sysprof_capture_writer_add_raw (SysprofCaptureWriter *self,
const SysprofCaptureFrame *frame); const SysprofCaptureFrame *frame);
G_GNUC_INTERNAL G_GNUC_INTERNAL
gboolean _sysprof_capture_writer_splice_from_fd (SysprofCaptureWriter *self, bool _sysprof_capture_writer_splice_from_fd (SysprofCaptureWriter *self,
int fd, int fd,
GError **error) G_GNUC_INTERNAL; GError **error) G_GNUC_INTERNAL;
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 start_time,
int64_t end_time) G_GNUC_INTERNAL; int64_t end_time) G_GNUC_INTERNAL;

View File

@ -58,6 +58,8 @@
#include "config.h" #include "config.h"
#include <stdbool.h>
#include "sysprof-clock.h" #include "sysprof-clock.h"
int sysprof_clock = -1; int sysprof_clock = -1;

View File

@ -66,6 +66,7 @@
#ifdef __linux__ #ifdef __linux__
# include <sched.h> # include <sched.h>
#endif #endif
#include <stdbool.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <sys/syscall.h> #include <sys/syscall.h>
@ -82,7 +83,7 @@
typedef struct typedef struct
{ {
MappedRingBuffer *buffer; MappedRingBuffer *buffer;
gboolean is_shared; bool is_shared;
int tid; int tid;
int pid; int pid;
} SysprofCollector; } SysprofCollector;
@ -99,7 +100,7 @@ static GPrivate single_trace_key = G_PRIVATE_INIT (NULL);
static SysprofCollector *shared_collector; static SysprofCollector *shared_collector;
static SysprofCollector invalid; static SysprofCollector invalid;
static inline gboolean static inline bool
use_single_trace (void) use_single_trace (void)
{ {
return GPOINTER_TO_INT (g_private_get (&single_trace_key)); return GPOINTER_TO_INT (g_private_get (&single_trace_key));

View File

@ -123,10 +123,10 @@ sysprof_control_source_init (SysprofControlSource *self)
g_array_set_clear_func (self->source_ids, remove_source_id); g_array_set_clear_func (self->source_ids, remove_source_id);
} }
static gboolean static bool
event_frame_cb (gconstpointer data, event_frame_cb (const void *data,
gsize *length, size_t *length,
gpointer user_data) void *user_data)
{ {
const SysprofCaptureFrame *fr = data; const SysprofCaptureFrame *fr = data;
RingData *rd = user_data; RingData *rd = user_data;

View File

@ -983,9 +983,9 @@ profiler_iface_init (SysprofProfilerInterface *iface)
iface->stopped = sysprof_local_profiler_real_stopped; iface->stopped = sysprof_local_profiler_real_stopped;
} }
static gboolean static bool
find_profiler_meta_cb (const SysprofCaptureFrame *frame, find_profiler_meta_cb (const SysprofCaptureFrame *frame,
gpointer user_data) void *user_data)
{ {
const SysprofCaptureMetadata *meta = (const SysprofCaptureMetadata *)frame; const SysprofCaptureMetadata *meta = (const SysprofCaptureMetadata *)frame;
GKeyFile **keyfile = user_data; GKeyFile **keyfile = user_data;
@ -1006,7 +1006,7 @@ find_profiler_meta_cb (const SysprofCaptureFrame *frame,
return *keyfile == NULL; return *keyfile == NULL;
} }
return TRUE; return true;
} }
SysprofProfiler * SysprofProfiler *

View File

@ -251,9 +251,9 @@ create_cursor (SysprofCaptureReader *reader)
return cursor; return cursor;
} }
static gboolean static bool
all_allocs_foreach_cb (const SysprofCaptureFrame *frame, all_allocs_foreach_cb (const SysprofCaptureFrame *frame,
gpointer user_data) void *user_data)
{ {
Generate *g = 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)); (gchar *)g_string_chunk_insert_const (g->symbols, cmdline));
} }
return TRUE; return true;
} }
/* Short-circuit if we don't care about this frame */ /* Short-circuit if we don't care about this frame */
if (!sysprof_selection_contains (g->selection, frame->time)) if (!sysprof_selection_contains (g->selection, frame->time))
return TRUE; return true;
if (frame->type == SYSPROF_CAPTURE_FRAME_ALLOCATION) if (frame->type == SYSPROF_CAPTURE_FRAME_ALLOCATION)
{ {
@ -361,7 +361,7 @@ all_allocs_foreach_cb (const SysprofCaptureFrame *frame,
} }
} }
return TRUE; return true;
} }
static gint static gint

View File

@ -22,13 +22,13 @@
#include <glib/gstdio.h> #include <glib/gstdio.h>
#include <sysprof-capture.h> #include <sysprof-capture.h>
static gboolean static bool
increment (const SysprofCaptureFrame *frame, increment (const SysprofCaptureFrame *frame,
gpointer user_data) void *user_data)
{ {
gint *count= user_data; gint *count= user_data;
(*count)++; (*count)++;
return TRUE; return true;
} }
static void static void

View File

@ -5,10 +5,10 @@
static gsize real_count; static gsize real_count;
static gboolean static bool
drain_nth_cb (gconstpointer data, drain_nth_cb (const void *data,
gsize *len, size_t *len,
gpointer user_data) void *user_data)
{ {
const gint64 *v64 = data; const gint64 *v64 = data;
g_assert_cmpint (*len, >=, 8); g_assert_cmpint (*len, >=, 8);
@ -17,10 +17,10 @@ drain_nth_cb (gconstpointer data,
return G_SOURCE_CONTINUE; return G_SOURCE_CONTINUE;
} }
static gboolean static bool
drain_count_cb (gconstpointer data, drain_count_cb (const void *data,
gsize *len, size_t *len,
gpointer user_data) void *user_data)
{ {
const gint64 *v64 = data; const gint64 *v64 = data;
g_assert_cmpint (*len, >=, 8); g_assert_cmpint (*len, >=, 8);
@ -93,10 +93,10 @@ typedef struct
gint64 done; gint64 done;
} ThreadedMessage; } ThreadedMessage;
static gboolean static bool
handle_msg (gconstpointer data, handle_msg (const void *data,
gsize *length, size_t *length,
gpointer user_data) void *user_data)
{ {
const ThreadedMessage *msg = data; const ThreadedMessage *msg = data;
gboolean *done = user_data; gboolean *done = user_data;

View File

@ -26,9 +26,9 @@
#include "../libsysprof/sysprof-capture-autocleanups.h" #include "../libsysprof/sysprof-capture-autocleanups.h"
static gboolean static bool
foreach_cb (const SysprofCaptureFrame *frame, foreach_cb (const SysprofCaptureFrame *frame,
gpointer user_data) void *user_data)
{ {
const SysprofCaptureSample *sample = (SysprofCaptureSample *)frame; const SysprofCaptureSample *sample = (SysprofCaptureSample *)frame;
GHashTable *seen = user_data; GHashTable *seen = user_data;
@ -38,7 +38,7 @@ foreach_cb (const SysprofCaptureFrame *frame,
GINT_TO_POINTER (sample->tid), GINT_TO_POINTER (sample->tid),
GINT_TO_POINTER (frame->pid)); GINT_TO_POINTER (frame->pid));
return TRUE; return true;
} }
gint gint