mirror of
https://sourceware.org/git/glibc.git
synced 2024-12-30 14:31:14 +00:00
30891f35fa
We stopped adding "Contributed by" or similar lines in sources in 2012 in favour of git logs and keeping the Contributors section of the glibc manual up to date. Removing these lines makes the license header a bit more consistent across files and also removes the possibility of error in attribution when license blocks or files are copied across since the contributed-by lines don't actually reflect reality in those cases. Move all "Contributed by" and similar lines (Written by, Test by, etc.) into a new file CONTRIBUTED-BY to retain record of these contributions. These contributors are also mentioned in manual/contrib.texi, so we just maintain this additional record as a courtesy to the earlier developers. The following scripts were used to filter a list of files to edit in place and to clean up the CONTRIBUTED-BY file respectively. These were not added to the glibc sources because they're not expected to be of any use in future given that this is a one time task: https://gist.github.com/siddhesh/b5ecac94eabfd72ed2916d6d8157e7dc https://gist.github.com/siddhesh/15ea1f5e435ace9774f485030695ee02 Reviewed-by: Carlos O'Donell <carlos@redhat.com>
67 lines
1.3 KiB
C
67 lines
1.3 KiB
C
#include <obstack.h>
|
|
#include <stdint.h>
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
|
|
#define obstack_chunk_alloc verbose_malloc
|
|
#define obstack_chunk_free verbose_free
|
|
#define ALIGN_BOUNDARY 64
|
|
#define ALIGN_MASK (ALIGN_BOUNDARY - 1)
|
|
#define OBJECT_SIZE 1000
|
|
|
|
static void *
|
|
verbose_malloc (size_t size)
|
|
{
|
|
void *buf = malloc (size);
|
|
printf ("malloc (%zu) => %p\n", size, buf);
|
|
return buf;
|
|
}
|
|
|
|
static void
|
|
verbose_free (void *buf)
|
|
{
|
|
free (buf);
|
|
printf ("free (%p)\n", buf);
|
|
}
|
|
|
|
static int
|
|
do_test (void)
|
|
{
|
|
int result = 0;
|
|
int align = 2;
|
|
|
|
while (align <= 64)
|
|
{
|
|
struct obstack obs;
|
|
int i;
|
|
int align_mask = align - 1;
|
|
|
|
printf ("\n Alignment mask: %d\n", align_mask);
|
|
|
|
obstack_init (&obs);
|
|
obstack_alignment_mask (&obs) = align_mask;
|
|
/* finish an empty object to take alignment into account */
|
|
obstack_finish (&obs);
|
|
|
|
/* let's allocate some objects and print their addresses */
|
|
for (i = 15; i > 0; --i)
|
|
{
|
|
void *obj = obstack_alloc (&obs, OBJECT_SIZE);
|
|
|
|
printf ("obstack_alloc (%u) => %p \t%s\n", OBJECT_SIZE, obj,
|
|
((uintptr_t) obj & align_mask) ? "(not aligned)" : "");
|
|
result |= ((uintptr_t) obj & align_mask) != 0;
|
|
}
|
|
|
|
/* clean up */
|
|
obstack_free (&obs, 0);
|
|
|
|
align <<= 1;
|
|
}
|
|
|
|
return result;
|
|
}
|
|
|
|
#define TEST_FUNCTION do_test ()
|
|
#include "../test-skeleton.c"
|