Using single underscore instead of two underscores for function prefixes

1998-06-07  Martin Baulig  <martin@home-of-linux.org>

	* *.[ch]: Using single underscore instead of two underscores
	for function prefixes (regexp: ``s,__([rspl])\b,_$1,g'') to
	avoid ambiguity with mangled C++ names.
This commit is contained in:
Martin Baulig
1998-06-07 13:57:45 +00:00
committed by Martin Baulig
parent 85f31a1707
commit c84923132a
129 changed files with 409 additions and 399 deletions

View File

@@ -24,7 +24,7 @@
/* Closes pipe to gtop server. */
void
glibtop_close (glibtop *server)
glibtop_close_r (glibtop *server)
{
kill (server->pid, SIGKILL);
close (server->input [0]);

View File

@@ -27,28 +27,28 @@
#include <glibtop/xmalloc.h>
void *
glibtop_call__l (glibtop *server, unsigned command, size_t send_size, void *send_buf,
glibtop_call_l (glibtop *server, unsigned command, size_t send_size, void *send_buf,
size_t recv_size, void *recv_buf)
{
glibtop_command *cmnd;
void *ptr;
glibtop_init__r (&server, 0, 0);
glibtop_init_r (&server, 0, 0);
cmnd = glibtop_calloc__r (server, 1, sizeof (glibtop_command));
cmnd = glibtop_calloc_r (server, 1, sizeof (glibtop_command));
memcpy (&cmnd->server, server, sizeof (glibtop));
cmnd->command = command;
cmnd->size = send_size;
glibtop_write__l (server, sizeof (glibtop_command), cmnd);
glibtop_write__l (server, send_size, send_buf);
glibtop_read__l (server, recv_size, recv_buf);
glibtop_write_l (server, sizeof (glibtop_command), cmnd);
glibtop_write_l (server, send_size, send_buf);
glibtop_read_l (server, recv_size, recv_buf);
ptr = glibtop_read_data__l (server);
ptr = glibtop_read_data_l (server);
glibtop_free__r (server, cmnd);
glibtop_free_r (server, cmnd);
return ptr;
}

View File

@@ -26,14 +26,14 @@
/* Provides information about cpu usage. */
void
glibtop_get_cpu__l (glibtop *server, glibtop_cpu *buf)
glibtop_get_cpu_l (glibtop *server, glibtop_cpu *buf)
{
glibtop_init__r (&server, GLIBTOP_SYSDEPS_CPU, 0);
glibtop_init_r (&server, GLIBTOP_SYSDEPS_CPU, 0);
if (server->features & GLIBTOP_SYSDEPS_CPU) {
glibtop_call__l (server, GLIBTOP_CMND_CPU, 0, NULL,
glibtop_call_l (server, GLIBTOP_CMND_CPU, 0, NULL,
sizeof (glibtop_cpu), buf);
} else {
glibtop_get_cpu__r (server, buf);
glibtop_get_cpu_r (server, buf);
}
}

View File

@@ -26,7 +26,7 @@ static glibtop _glibtop_global_server;
glibtop *glibtop_global_server = NULL;
glibtop *
glibtop_init__r (glibtop **server, const unsigned long features,
glibtop_init_r (glibtop **server, const unsigned long features,
const unsigned flags)
{
if (*server != NULL)
@@ -34,7 +34,7 @@ glibtop_init__r (glibtop **server, const unsigned long features,
if (glibtop_global_server == NULL) {
glibtop_global_server = &_glibtop_global_server;
glibtop_open__l (glibtop_global_server, "glibtop",
glibtop_open_l (glibtop_global_server, "glibtop",
features, flags);
}

View File

@@ -26,14 +26,14 @@
/* Provides load averange. */
void
glibtop_get_loadavg__l (glibtop *server, glibtop_loadavg *buf)
glibtop_get_loadavg_l (glibtop *server, glibtop_loadavg *buf)
{
glibtop_init__r (&server, GLIBTOP_SYSDEPS_LOADAVG, 0);
glibtop_init_r (&server, GLIBTOP_SYSDEPS_LOADAVG, 0);
if (server->features & GLIBTOP_SYSDEPS_LOADAVG) {
glibtop_call__l (server, GLIBTOP_CMND_LOADAVG, 0, NULL,
glibtop_call_l (server, GLIBTOP_CMND_LOADAVG, 0, NULL,
sizeof (glibtop_loadavg), buf);
} else {
glibtop_get_loadavg__r (server, buf);
glibtop_get_loadavg_r (server, buf);
}
}

View File

@@ -25,14 +25,14 @@
/* Provides information about memory usage. */
void
glibtop_get_mem__l (glibtop *server, glibtop_mem *buf)
glibtop_get_mem_l (glibtop *server, glibtop_mem *buf)
{
glibtop_init__r (&server, GLIBTOP_SYSDEPS_MEM, 0);
glibtop_init_r (&server, GLIBTOP_SYSDEPS_MEM, 0);
if (server->features & GLIBTOP_SYSDEPS_MEM) {
glibtop_call__l (server, GLIBTOP_CMND_MEM, 0, NULL,
glibtop_call_l (server, GLIBTOP_CMND_MEM, 0, NULL,
sizeof (glibtop_mem), buf);
} else {
glibtop_get_mem__r (server, buf);
glibtop_get_mem_r (server, buf);
}
}

View File

@@ -25,14 +25,14 @@
/* Provides information about sysv ipc limits. */
void
glibtop_get_msg_limits__l (glibtop *server, glibtop_msg_limits *buf)
glibtop_get_msg_limits_l (glibtop *server, glibtop_msg_limits *buf)
{
glibtop_init__r (&server, GLIBTOP_SYSDEPS_MSG_LIMITS, 0);
glibtop_init_r (&server, GLIBTOP_SYSDEPS_MSG_LIMITS, 0);
if (server->features & GLIBTOP_SYSDEPS_MSG_LIMITS) {
glibtop_call__l (server, GLIBTOP_CMND_MSG_LIMITS, 0, NULL,
glibtop_call_l (server, GLIBTOP_CMND_MSG_LIMITS, 0, NULL,
sizeof (glibtop_msg_limits), buf);
} else {
glibtop_get_msg_limits__r (server, buf);
glibtop_get_msg_limits_r (server, buf);
}
}

View File

@@ -28,7 +28,7 @@
/* Opens pipe to gtop server. Returns 0 on success and -1 on error. */
void
glibtop_open__l (glibtop *server, const char *program_name,
glibtop_open_l (glibtop *server, const char *program_name,
const unsigned long features, const unsigned flags)
{
char version [BUFSIZ], buffer [BUFSIZ];
@@ -49,14 +49,14 @@ glibtop_open__l (glibtop *server, const char *program_name,
temp = getenv ("LIBGTOP_SERVER") ?
getenv ("LIBGTOP_SERVER") : GTOP_SERVER;
server_command = glibtop_malloc__r (server, strlen (temp) + 1);
server_command = glibtop_malloc_r (server, strlen (temp) + 1);
strcpy (server_command, temp);
temp = getenv ("LIBGTOP_RSH") ?
getenv ("LIBGTOP_RSH") : "rsh";
server_rsh = glibtop_malloc__r (server, strlen (temp) + 1);
server_rsh = glibtop_malloc_r (server, strlen (temp) + 1);
strcpy (server_rsh, temp);
@@ -103,13 +103,13 @@ glibtop_open__l (glibtop *server, const char *program_name,
/* Fork and exec server. */
if (pipe (server->input) || pipe (server->output))
glibtop_error__r (server, _("cannot make a pipe: %s\n"),
glibtop_error_r (server, _("cannot make a pipe: %s\n"),
strerror (errno));
server->pid = fork ();
if (server->pid < 0) {
glibtop_error__r (server, _("%s: fork failed: %s\n"),
glibtop_error_r (server, _("%s: fork failed: %s\n"),
strerror (errno));
} else if (server->pid == 0) {
close (0); close (1); /* close (2); */
@@ -140,14 +140,14 @@ glibtop_open__l (glibtop *server, const char *program_name,
sprintf (version, "%s server %s ready.\n", PACKAGE, VERSION);
glibtop_read__l (server, strlen (version), buffer);
glibtop_read_l (server, strlen (version), buffer);
if (memcmp (version, buffer, strlen (version)))
glibtop_error__r (server, _("server version is not %s"), VERSION);
glibtop_error_r (server, _("server version is not %s"), VERSION);
fprintf (stderr, "Calling GLITOP_CMND_SYSDEPS ...\n");
glibtop_call__l (server, GLIBTOP_CMND_SYSDEPS, 0, NULL,
glibtop_call_l (server, GLIBTOP_CMND_SYSDEPS, 0, NULL,
sizeof (glibtop_sysdeps), &sysdeps);
server->features = sysdeps.features;

View File

@@ -26,15 +26,15 @@
/* Provides detailed information about a process. */
void
glibtop_get_proc_kernel__l (glibtop *server, glibtop_proc_kernel *buf,
glibtop_get_proc_kernel_l (glibtop *server, glibtop_proc_kernel *buf,
pid_t pid)
{
glibtop_init__r (&server, GLIBTOP_SYSDEPS_PROC_KERNEL, 0);
glibtop_init_r (&server, GLIBTOP_SYSDEPS_PROC_KERNEL, 0);
if (server->features & GLIBTOP_SYSDEPS_PROC_KERNEL) {
glibtop_call__l (server, GLIBTOP_CMND_PROC_KERNEL, sizeof (pid_t),
glibtop_call_l (server, GLIBTOP_CMND_PROC_KERNEL, sizeof (pid_t),
&pid, sizeof (glibtop_proc_kernel), buf);
} else {
glibtop_get_proc_kernel__r (server, buf, pid);
glibtop_get_proc_kernel_r (server, buf, pid);
}
}

View File

@@ -25,14 +25,14 @@
/* Fetch list of currently running processes. */
unsigned *
glibtop_get_proclist__l (glibtop *server, glibtop_proclist *buf)
glibtop_get_proclist_l (glibtop *server, glibtop_proclist *buf)
{
glibtop_init__r (&server, GLIBTOP_SYSDEPS_PROCLIST, 0);
glibtop_init_r (&server, GLIBTOP_SYSDEPS_PROCLIST, 0);
if (server->features & GLIBTOP_SYSDEPS_PROCLIST) {
return glibtop_call__l (server, GLIBTOP_CMND_PROCLIST, 0, NULL,
return glibtop_call_l (server, GLIBTOP_CMND_PROCLIST, 0, NULL,
sizeof (glibtop_proclist), buf);
} else {
return glibtop_get_proclist__r (server, buf);
return glibtop_get_proclist_r (server, buf);
}
}

View File

@@ -26,15 +26,15 @@
/* Provides detailed information about a process. */
void
glibtop_get_proc_mem__l (glibtop *server, glibtop_proc_mem *buf,
glibtop_get_proc_mem_l (glibtop *server, glibtop_proc_mem *buf,
pid_t pid)
{
glibtop_init__r (&server, GLIBTOP_SYSDEPS_PROC_MEM, 0);
glibtop_init_r (&server, GLIBTOP_SYSDEPS_PROC_MEM, 0);
if (server->features & GLIBTOP_SYSDEPS_PROC_MEM) {
glibtop_call__l (server, GLIBTOP_CMND_PROC_MEM, sizeof (pid_t),
glibtop_call_l (server, GLIBTOP_CMND_PROC_MEM, sizeof (pid_t),
&pid, sizeof (glibtop_proc_mem), buf);
} else {
glibtop_get_proc_mem__r (server, buf, pid);
glibtop_get_proc_mem_r (server, buf, pid);
}
}

View File

@@ -26,15 +26,15 @@
/* Provides detailed information about a process. */
void
glibtop_get_proc_segment__l (glibtop *server, glibtop_proc_segment *buf,
glibtop_get_proc_segment_l (glibtop *server, glibtop_proc_segment *buf,
pid_t pid)
{
glibtop_init__r (&server, GLIBTOP_SYSDEPS_PROC_SEGMENT, 0);
glibtop_init_r (&server, GLIBTOP_SYSDEPS_PROC_SEGMENT, 0);
if (server->features & GLIBTOP_SYSDEPS_PROC_SEGMENT) {
glibtop_call__l (server, GLIBTOP_CMND_PROC_SEGMENT, sizeof (pid_t),
glibtop_call_l (server, GLIBTOP_CMND_PROC_SEGMENT, sizeof (pid_t),
&pid, sizeof (glibtop_proc_segment), buf);
} else {
glibtop_get_proc_segment__r (server, buf, pid);
glibtop_get_proc_segment_r (server, buf, pid);
}
}

View File

@@ -26,15 +26,15 @@
/* Provides detailed information about a process. */
void
glibtop_get_proc_signal__l (glibtop *server, glibtop_proc_signal *buf,
glibtop_get_proc_signal_l (glibtop *server, glibtop_proc_signal *buf,
pid_t pid)
{
glibtop_init__r (&server, GLIBTOP_SYSDEPS_PROC_SIGNAL, 0);
glibtop_init_r (&server, GLIBTOP_SYSDEPS_PROC_SIGNAL, 0);
if (server->features & GLIBTOP_SYSDEPS_PROC_SIGNAL) {
glibtop_call__l (server, GLIBTOP_CMND_PROC_SIGNAL, sizeof (pid_t),
glibtop_call_l (server, GLIBTOP_CMND_PROC_SIGNAL, sizeof (pid_t),
&pid, sizeof (glibtop_proc_signal), buf);
} else {
glibtop_get_proc_signal__r (server, buf, pid);
glibtop_get_proc_signal_r (server, buf, pid);
}
}

View File

@@ -26,15 +26,15 @@
/* Provides detailed information about a process. */
void
glibtop_get_proc_state__l (glibtop *server, glibtop_proc_state *buf,
glibtop_get_proc_state_l (glibtop *server, glibtop_proc_state *buf,
pid_t pid)
{
glibtop_init__r (&server, GLIBTOP_SYSDEPS_PROC_STATE, 0);
glibtop_init_r (&server, GLIBTOP_SYSDEPS_PROC_STATE, 0);
if (server->features & GLIBTOP_SYSDEPS_PROC_STATE) {
glibtop_call__l (server, GLIBTOP_CMND_PROC_STATE, sizeof (pid_t),
glibtop_call_l (server, GLIBTOP_CMND_PROC_STATE, sizeof (pid_t),
&pid, sizeof (glibtop_proc_state), buf);
} else {
glibtop_get_proc_state__r (server, buf, pid);
glibtop_get_proc_state_r (server, buf, pid);
}
}

View File

@@ -26,15 +26,15 @@
/* Provides detailed information about a process. */
void
glibtop_get_proc_time__l (glibtop *server, glibtop_proc_time *buf,
glibtop_get_proc_time_l (glibtop *server, glibtop_proc_time *buf,
pid_t pid)
{
glibtop_init__r (&server, GLIBTOP_SYSDEPS_PROC_TIME, 0);
glibtop_init_r (&server, GLIBTOP_SYSDEPS_PROC_TIME, 0);
if (server->features & GLIBTOP_SYSDEPS_PROC_TIME) {
glibtop_call__l (server, GLIBTOP_CMND_PROC_TIME, sizeof (pid_t),
glibtop_call_l (server, GLIBTOP_CMND_PROC_TIME, sizeof (pid_t),
&pid, sizeof (glibtop_proc_time), buf);
} else {
glibtop_get_proc_time__r (server, buf, pid);
glibtop_get_proc_time_r (server, buf, pid);
}
}

View File

@@ -26,15 +26,15 @@
/* Provides detailed information about a process. */
void
glibtop_get_proc_uid__l (glibtop *server, glibtop_proc_uid *buf,
glibtop_get_proc_uid_l (glibtop *server, glibtop_proc_uid *buf,
pid_t pid)
{
glibtop_init__r (&server, GLIBTOP_SYSDEPS_PROC_UID, 0);
glibtop_init_r (&server, GLIBTOP_SYSDEPS_PROC_UID, 0);
if (server->features & GLIBTOP_SYSDEPS_PROC_UID) {
glibtop_call__l (server, GLIBTOP_CMND_PROC_UID, sizeof (pid_t),
glibtop_call_l (server, GLIBTOP_CMND_PROC_UID, sizeof (pid_t),
&pid, sizeof (glibtop_proc_uid), buf);
} else {
glibtop_get_proc_uid__r (server, buf, pid);
glibtop_get_proc_uid_r (server, buf, pid);
}
}

View File

@@ -24,18 +24,18 @@
/* Reads some data from server. */
void
glibtop_read__l (glibtop *server, size_t size, void *buf)
glibtop_read_l (glibtop *server, size_t size, void *buf)
{
size_t ssize;
glibtop_init__r (&server, 0, 0);
glibtop_init_r (&server, 0, 0);
if (read (server->input [0], &ssize, sizeof (size_t)) < 0)
glibtop_error__r (server, _("read size: %s"), strerror (errno));
glibtop_error_r (server, _("read size: %s"), strerror (errno));
if (size != ssize)
glibtop_error__r (server, _("got %d bytes but requested %d"), ssize, size);
glibtop_error_r (server, _("got %d bytes but requested %d"), ssize, size);
if (read (server->input [0], buf, size) < 0)
glibtop_error__r (server, _("read %d bytes: %s"), size, strerror (errno));
glibtop_error_r (server, _("read %d bytes: %s"), size, strerror (errno));
}

View File

@@ -25,23 +25,23 @@
/* Reads some data from server. */
void *
glibtop_read_data__l (glibtop *server)
glibtop_read_data_l (glibtop *server)
{
size_t size;
void *ptr;
glibtop_init__r (&server, 0, 0);
glibtop_init_r (&server, 0, 0);
if (read (server->input [0], &size, sizeof (size_t)) < 0)
glibtop_error__r (server, _("read data size: %s"),
glibtop_error_r (server, _("read data size: %s"),
strerror (errno));
if (!size) return NULL;
ptr = glibtop_malloc__r (server, size);
ptr = glibtop_malloc_r (server, size);
if (read (server->input [0], ptr, size) < 0)
glibtop_error__r (server, _("read data %d bytes: %s"),
glibtop_error_r (server, _("read data %d bytes: %s"),
size, strerror (errno));
return ptr;

View File

@@ -25,14 +25,14 @@
/* Provides information about sysv ipc limits. */
void
glibtop_get_sem_limits__l (glibtop *server, glibtop_sem_limits *buf)
glibtop_get_sem_limits_l (glibtop *server, glibtop_sem_limits *buf)
{
glibtop_init__r (&server, GLIBTOP_SYSDEPS_SEM_LIMITS, 0);
glibtop_init_r (&server, GLIBTOP_SYSDEPS_SEM_LIMITS, 0);
if (server->features & GLIBTOP_SYSDEPS_SEM_LIMITS) {
glibtop_call__l (server, GLIBTOP_CMND_SEM_LIMITS, 0, NULL,
glibtop_call_l (server, GLIBTOP_CMND_SEM_LIMITS, 0, NULL,
sizeof (glibtop_sem_limits), buf);
} else {
glibtop_get_sem_limits__r (server, buf);
glibtop_get_sem_limits_r (server, buf);
}
}

View File

@@ -25,14 +25,14 @@
/* Provides information about sysv ipc limits. */
void
glibtop_get_shm_limits__l (glibtop *server, glibtop_shm_limits *buf)
glibtop_get_shm_limits_l (glibtop *server, glibtop_shm_limits *buf)
{
glibtop_init__r (&server, GLIBTOP_SYSDEPS_SHM_LIMITS, 0);
glibtop_init_r (&server, GLIBTOP_SYSDEPS_SHM_LIMITS, 0);
if (server->features & GLIBTOP_SYSDEPS_SHM_LIMITS) {
glibtop_call__l (server, GLIBTOP_CMND_SHM_LIMITS, 0, NULL,
glibtop_call_l (server, GLIBTOP_CMND_SHM_LIMITS, 0, NULL,
sizeof (glibtop_shm_limits), buf);
} else {
glibtop_get_shm_limits__r (server, buf);
glibtop_get_shm_limits_r (server, buf);
}
}

View File

@@ -25,14 +25,14 @@
/* Provides information about swap usage. */
void
glibtop_get_swap__l (glibtop *server, glibtop_swap *buf)
glibtop_get_swap_l (glibtop *server, glibtop_swap *buf)
{
glibtop_init__r (&server, GLIBTOP_SYSDEPS_SWAP, 0);
glibtop_init_r (&server, GLIBTOP_SYSDEPS_SWAP, 0);
if (server->features & GLIBTOP_SYSDEPS_SWAP) {
glibtop_call__l (server, GLIBTOP_CMND_SWAP, 0, NULL,
glibtop_call_l (server, GLIBTOP_CMND_SWAP, 0, NULL,
sizeof (glibtop_swap), buf);
} else {
glibtop_get_swap__r (server, buf);
glibtop_get_swap_r (server, buf);
}
}

View File

@@ -26,14 +26,14 @@
/* Provides uptime and idle time. */
void
glibtop_get_uptime__l (glibtop *server, glibtop_uptime *buf)
glibtop_get_uptime_l (glibtop *server, glibtop_uptime *buf)
{
glibtop_init__r (&server, GLIBTOP_SYSDEPS_UPTIME, 0);
glibtop_init_r (&server, GLIBTOP_SYSDEPS_UPTIME, 0);
if (server->features & GLIBTOP_SYSDEPS_UPTIME) {
glibtop_call__l (server, GLIBTOP_CMND_UPTIME, 0, NULL,
glibtop_call_l (server, GLIBTOP_CMND_UPTIME, 0, NULL,
sizeof (glibtop_uptime), buf);
} else {
glibtop_get_uptime__r (server, buf);
glibtop_get_uptime_r (server, buf);
}
}

View File

@@ -24,15 +24,15 @@
/* Writes some data to server. */
void
glibtop_write__l (glibtop *server, size_t size, void *buf)
glibtop_write_l (glibtop *server, size_t size, void *buf)
{
glibtop_init__r (&server, 0, 0);
glibtop_init_r (&server, 0, 0);
if (write (server->output [1], &size, sizeof (size_t)) < 0)
glibtop_error__r (server, _("write size: %s"), strerror (errno));
glibtop_error_r (server, _("write size: %s"), strerror (errno));
if (!size) return;
if (write (server->output [1], buf, size) < 0)
glibtop_error__r (server, _("write %d bytes: %s"), size, strerror (errno));
glibtop_error_r (server, _("write %d bytes: %s"), size, strerror (errno));
}