Author: chromatic
Date: Mon Dec 29 00:01:42 2008
New Revision: 34559
Modified:
trunk/src/gc/resources.c
trunk/src/inter_call.c
trunk/src/io/buffer.c
trunk/src/stm/waitlist.c
Log:
[src] Tidied some source code; no functional changes.
Modified: trunk/src/gc/resources.c
==============================================================================
--- trunk/src/gc/resources.c (original)
+++ trunk/src/gc/resources.c Mon Dec 29 00:01:42 2008
@@ -776,9 +776,8 @@
PObj_constant_TEST(str)
? interp->arena_base->constant_string_pool
: interp->arena_base->memory_pool;
- /*
- * if the requested size is smaller then buflen, we are done
- */
+
+ /* if the requested size is smaller then buflen, we are done */
if (newsize <= PObj_buflen(str))
return;
@@ -789,26 +788,28 @@
*/
new_size = aligned_string_size(newsize);
old_size = aligned_string_size(PObj_buflen(str));
- needed = new_size - old_size;
- if (pool->top_block->free >= needed &&
- pool->top_block->top == (char*)PObj_bufstart(str) +
- old_size) {
+ needed = new_size - old_size;
+
+ if (pool->top_block->free >= needed
+ && pool->top_block->top == (char *)PObj_bufstart(str) + old_size) {
pool->top_block->free -= needed;
pool->top_block->top += needed;
PObj_buflen(str) = new_size - sizeof (void*);
return;
}
+
PARROT_ASSERT(str->bufused <= newsize);
+
/* only copy used memory, not total string buffer */
copysize = str->bufused;
- if (!PObj_COW_TEST(str)) {
+ if (!PObj_COW_TEST(str))
pool->guaranteed_reclaimable += PObj_buflen(str);
- }
+
pool->possibly_reclaimable += PObj_buflen(str);
mem = (char *)mem_allocate(interp, new_size, pool);
- mem += sizeof (void*);
+ mem += sizeof (void *);
/* copy mem from strstart, *not* bufstart */
oldmem = str->strstart;
@@ -818,9 +819,8 @@
/* We shouldn't ever have a 0 from size, but we do. If we can track down
* those bugs, this can be removed which would make things cheaper */
- if (copysize) {
+ if (copysize)
memcpy(mem, oldmem, copysize);
- }
}
/*
Modified: trunk/src/inter_call.c
==============================================================================
--- trunk/src/inter_call.c (original)
+++ trunk/src/inter_call.c Mon Dec 29 00:01:42 2008
@@ -333,7 +333,7 @@
PARROT_EXPORT
int
Parrot_init_arg_indexes_and_sig_pmc(SHIM_INTERP, ARGIN(Parrot_Context *ctx),
- ARGIN_NULLOK(opcode_t *indexes), ARGIN_NULLOK(PMC* sig_pmc),
+ ARGIN_NULLOK(opcode_t *indexes), ARGIN_NULLOK(PMC *sig_pmc),
ARGMOD(call_state_item *sti))
{
if (!sig_pmc && indexes) {
@@ -1415,7 +1415,7 @@
/*
* Workaround for several argument passing problems
- * RT#54860 y otros
+ * RT #54860 y otros
* Save current value while setting the optional
*/
UnionVal old_value;
@@ -1623,7 +1623,7 @@
void
parrot_pass_args(PARROT_INTERP,
ARGMOD(Parrot_Context *src_ctx), ARGMOD(Parrot_Context *dest_ctx),
- ARGMOD(opcode_t *src_indexes), ARGMOD(opcode_t *dest_indexes),
+ ARGMOD(opcode_t *src_indexes), ARGMOD(opcode_t *dest_indexes),
arg_pass_t param_or_result)
{
call_state st;
Modified: trunk/src/io/buffer.c
==============================================================================
--- trunk/src/io/buffer.c (original)
+++ trunk/src/io/buffer.c Mon Dec 29 00:01:42 2008
@@ -254,6 +254,7 @@
return got;
}
+
/*
=item C<size_t Parrot_io_read_buffer>
@@ -268,12 +269,11 @@
Parrot_io_read_buffer(PARROT_INTERP, ARGMOD(PMC *filehandle),
ARGIN(STRING **buf))
{
- unsigned char *out_buf;
- STRING *s;
- size_t len;
- size_t current = 0;
- INTVAL buffer_flags = Parrot_io_get_buffer_flags(interp, filehandle);
- unsigned char *buffer_start, *buffer_next, *buffer_end;
+ unsigned char *out_buf, *buffer_start, *buffer_next, *buffer_end;
+ STRING *s;
+ size_t len;
+ size_t current = 0;
+ INTVAL buffer_flags = Parrot_io_get_buffer_flags(interp,
filehandle);
/* write buffer flush */
if (buffer_flags & PIO_BF_WRITEBUF) {
@@ -286,25 +286,27 @@
buffer_end = Parrot_io_get_buffer_end(interp, filehandle);
/* line buffered read */
- if (Parrot_io_get_flags(interp, filehandle) & PIO_F_LINEBUF) {
+ if (Parrot_io_get_flags(interp, filehandle) & PIO_F_LINEBUF)
return Parrot_io_readline_buffer(interp, filehandle, buf);
- }
if (*buf == NULL) {
*buf = new_string_header(interp, 0);
(*buf)->bufused = len = 2048;
}
- s = *buf;
+
+ s = *buf;
len = s->bufused;
- if (!s->strstart) {
+
+ if (!s->strstart)
Parrot_allocate_string(interp, s, len);
- }
+
out_buf = (unsigned char *)s->strstart;
+
/* read Data from buffer */
if (buffer_flags & PIO_BF_READBUF) {
const size_t avail = buffer_end - buffer_next;
+ current = avail < len ? avail : len;
- current = avail < len ? avail : len;
memcpy(out_buf, buffer_next, current);
buffer_next += current;
Parrot_io_set_buffer_next(interp, filehandle, buffer_next);
@@ -315,6 +317,7 @@
if (current == avail) {
buffer_flags &= ~PIO_BF_READBUF;
Parrot_io_set_buffer_flags(interp, filehandle, buffer_flags);
+
/* Reset next and end */
Parrot_io_set_buffer_end(interp, filehandle, NULL);
Parrot_io_set_buffer_next(interp, filehandle, buffer_start);
@@ -337,8 +340,8 @@
size_t got;
if (len >= Parrot_io_get_buffer_size(interp, filehandle)) {
- STRING fake;
- STRING *sf = &fake;
+ STRING fake;
+ STRING *sf = &fake;
fake.strstart = (char *)out_buf;
fake.bufused = len;
Modified: trunk/src/stm/waitlist.c
==============================================================================
--- trunk/src/stm/waitlist.c (original)
+++ trunk/src/stm/waitlist.c Mon Dec 29 00:01:42 2008
@@ -15,7 +15,7 @@
=head1 DESCRIPTION
-RT#48260: Not yet documented!!!
+RT #48260: Not yet documented!!!
=head2 Functions
@@ -91,7 +91,7 @@
=item C<static struct waitlist_thread_data * get_thread>
-RT#48260: Not yet documented!!!
+RT #48260: Not yet documented!!!
=cut
@@ -120,7 +120,7 @@
=item C<static struct waitlist_thread_data * get_thread_noalloc>
-RT#48260: Not yet documented!!!
+RT #48260: Not yet documented!!!
=cut
@@ -139,7 +139,7 @@
=item C<static struct waitlist_entry * alloc_entry>
-RT#48260: Not yet documented!!!
+RT #48260: Not yet documented!!!
=cut
@@ -182,7 +182,7 @@
=item C<static void add_entry>
-RT#48260: Not yet documented!!!
+RT #48260: Not yet documented!!!
=cut
@@ -211,7 +211,7 @@
=item C<static int remove_first>
-RT#48260: Not yet documented!!!
+RT #48260: Not yet documented!!!
=cut
@@ -236,7 +236,7 @@
=item C<static void waitlist_remove>
-RT#48260: Not yet documented!!!
+RT #48260: Not yet documented!!!
=cut
@@ -294,7 +294,7 @@
=item C<static void waitlist_remove_check>
-RT#48260: Not yet documented!!!
+RT #48260: Not yet documented!!!
=cut
@@ -322,7 +322,7 @@
=item C<static void waitlist_signal_one>
-RT#48260: Not yet documented!!!
+RT #48260: Not yet documented!!!
=cut
@@ -350,7 +350,7 @@
=item C<static void waitlist_signal_all>
-RT#48260: Not yet documented!!!
+RT #48260: Not yet documented!!!
=cut
@@ -396,7 +396,7 @@
=item C<void Parrot_STM_waitlist_add_self>
-RT#48260: Not yet documented!!!
+RT #48260: Not yet documented!!!
=cut
@@ -419,7 +419,7 @@
=item C<void Parrot_STM_waitlist_signal>
-RT#48260: Not yet documented!!!
+RT #48260: Not yet documented!!!
=cut
@@ -438,7 +438,7 @@
=item C<void Parrot_STM_waitlist_remove_all>
-RT#48260: Not yet documented!!!
+RT #48260: Not yet documented!!!
=cut
@@ -476,7 +476,7 @@
=item C<void Parrot_STM_waitlist_wait>
-RT#48260: Not yet documented!!!
+RT #48260: Not yet documented!!!
=cut
@@ -507,7 +507,7 @@
=item C<void Parrot_STM_waitlist_init>
-RT#48260: Not yet documented!!!
+RT #48260: Not yet documented!!!
=cut
@@ -525,7 +525,7 @@
=item C<void Parrot_STM_waitlist_destroy_thread>
-RT#48260: Not yet documented!!!
+RT #48260: Not yet documented!!!
=cut
@@ -556,7 +556,7 @@
=item C<static STM_tx_log * Parrot_STM_tx_log_alloc>
-RT#48260: Not yet documented!!!
+RT #48260: Not yet documented!!!
=cut
@@ -600,7 +600,7 @@
=item C<STM_tx_log * Parrot_STM_tx_log_get>
-RT#48260: Not yet documented!!!
+RT #48260: Not yet documented!!!
=cut