mm, audio, crypto, graphics: Fix various spacing/alignment issues

This commit is contained in:
Gregory Nutt
2015-10-08 09:10:22 -06:00
parent 78ae661223
commit 06cd5b2fcc
31 changed files with 92 additions and 90 deletions
+1 -1
Submodule arch updated: ecb6712035...8faab42f9a
+6 -6
View File
@@ -379,7 +379,7 @@ static int audio_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
case AUDIOIOC_GETCAPS:
{
FAR struct audio_caps_s *caps = (FAR struct audio_caps_s*)((uintptr_t)arg);
FAR struct audio_caps_s *caps = (FAR struct audio_caps_s *)((uintptr_t)arg);
DEBUGASSERT(lower->ops->getcaps != NULL);
audvdbg("AUDIOIOC_GETCAPS: Device=%d\n", caps->ac_type);
@@ -393,7 +393,7 @@ static int audio_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
case AUDIOIOC_CONFIGURE:
{
FAR const struct audio_caps_desc_s *caps =
(FAR const struct audio_caps_desc_s*)((uintptr_t)arg);
(FAR const struct audio_caps_desc_s *)((uintptr_t)arg);
DEBUGASSERT(lower->ops->configure != NULL);
audvdbg("AUDIOIOC_INITIALIZE: Device=%d\n", caps->caps.ac_type);
@@ -873,11 +873,11 @@ int audio_register(FAR const char *name, FAR struct audio_lowerhalf_s *dev)
char path[AUDIO_MAX_DEVICE_PATH];
static bool dev_audio_created = false;
#ifndef CONFIG_AUDIO_CUSTOM_DEV_PATH
const char* devname = "/dev/audio";
FAR const char *devname = "/dev/audio";
#elif !defined(CONFIG_AUDIO_DEV_ROOT)
const char* devname = CONFIG_AUDIO_DEV_PATH;
const char* ptr;
char* pathptr;
FAR const char *devname = CONFIG_AUDIO_DEV_PATH;
FAR const char *ptr;
FAR char *pathptr;
#endif
/* Allocate the upper-half data structure */
+17 -17
View File
@@ -259,23 +259,23 @@ static void pcm_callback(FAR void *arg, uint16_t reason,
#ifdef CONFIG_PCM_DEBUG
static void pcm_dump(FAR const struct wav_header_s *wav)
{
dbg( "Wave file header\n");
dbg( " Header Chunk:\n");
dbg( " Chunk ID: 0x%08x\n", wav->hdr.chunkid);
dbg( " Chunk Size: %u\n", wav->hdr.chunklen);
dbg( " Format: 0x%08x\n", wav->hdr.format);
dbg( " Format Chunk:\n");
dbg( " Chunk ID: 0x%08x\n", wav->fmt.chunkid);
dbg( " Chunk Size: %u\n", wav->fmt.chunklen);
dbg( " Audio Format: 0x%04x\n", wav->fmt.format);
dbg( " Num. Channels: %d\n", wav->fmt.nchannels);
dbg( " Sample Rate: %u\n", wav->fmt.samprate);
dbg( " Byte Rate: %u\n", wav->fmt.byterate);
dbg( " Block Align: %d\n", wav->fmt.align);
dbg( " Bits Per Sample: %d\n", wav->fmt.bpsamp);
dbg( " Data Chunk:\n");
dbg( " Chunk ID: 0x%08x\n", wav->data.chunkid);
dbg( " Chunk Size: %u\n", wav->data.chunklen);
dbg("Wave file header\n");
dbg(" Header Chunk:\n");
dbg(" Chunk ID: 0x%08x\n", wav->hdr.chunkid);
dbg(" Chunk Size: %u\n", wav->hdr.chunklen);
dbg(" Format: 0x%08x\n", wav->hdr.format);
dbg(" Format Chunk:\n");
dbg(" Chunk ID: 0x%08x\n", wav->fmt.chunkid);
dbg(" Chunk Size: %u\n", wav->fmt.chunklen);
dbg(" Audio Format: 0x%04x\n", wav->fmt.format);
dbg(" Num. Channels: %d\n", wav->fmt.nchannels);
dbg(" Sample Rate: %u\n", wav->fmt.samprate);
dbg(" Byte Rate: %u\n", wav->fmt.byterate);
dbg(" Block Align: %d\n", wav->fmt.align);
dbg(" Bits Per Sample: %d\n", wav->fmt.bpsamp);
dbg(" Data Chunk:\n");
dbg(" Chunk ID: 0x%08x\n", wav->data.chunkid);
dbg(" Chunk Size: %u\n", wav->data.chunklen);
}
#endif
+4 -4
View File
@@ -96,11 +96,11 @@ static ssize_t cryptodev_write(FAR struct file *filep, FAR const char *buffer,
static int cryptodev_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
{
switch(cmd)
switch (cmd)
{
case CIOCGSESSION:
{
struct session_op *ses = (struct session_op*)arg;
FAR struct session_op *ses = (FAR struct session_op *)arg;
ses->ses = (uint32_t)ses;
return OK;
}
@@ -112,8 +112,8 @@ static int cryptodev_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
case CIOCCRYPT:
{
FAR struct crypt_op *op = (struct crypt_op*)arg;
FAR struct session_op *ses = (struct session_op*)op->ses;
FAR struct crypt_op *op = (FAR struct crypt_op *)arg;
FAR struct session_op *ses = (FAR struct session_op *)op->ses;
int encrypt;
switch (op->op)
+1 -1
View File
@@ -68,7 +68,7 @@
* Private Functions
****************************************************************************/
static int do_test_aes(FAR struct cipher_testvec* test, int mode, int encrypt)
static int do_test_aes(FAR struct cipher_testvec *test, int mode, int encrypt)
{
FAR void *out = kmm_zalloc(test->rlen);
+8 -6
View File
@@ -85,16 +85,18 @@
int nxbe_colormap(FAR NX_DRIVERTYPE *dev)
{
struct fb_cmap_s cmap;
uint8_t *alloc;
uint8_t *red;
uint8_t *green;
uint8_t *blue;
FAR uint8_t *alloc;
FAR uint8_t *red;
FAR uint8_t *green;
FAR uint8_t *blue;
uint8_t rval;
uint8_t gval;
int size;
int ndx;
int ret;
int i, j, k;
int i;
int j;
int k;
/* Allocate the color map tables in one allocation:
*
@@ -102,7 +104,7 @@ int nxbe_colormap(FAR NX_DRIVERTYPE *dev)
*/
size = 3 * CONFIG_NX_NCOLORS * sizeof(uint8_t);
alloc = (uint8_t*)kmm_malloc(size);
alloc = (FAR uint8_t *)kmm_malloc(size);
if (alloc == NULL)
{
return -ENOMEM;
+3 -3
View File
@@ -79,7 +79,7 @@
*
****************************************************************************/
void NXGL_FUNCNAME(nxgl_copyrectangle,NXGLIB_SUFFIX)
void NXGL_FUNCNAME(nxgl_copyrectangle, NXGLIB_SUFFIX)
(FAR struct fb_planeinfo_s *pinfo, FAR const struct nxgl_rect_s *dest,
FAR const void *src, FAR const struct nxgl_point_s *origin,
unsigned int srcstride)
@@ -131,7 +131,7 @@ void NXGL_FUNCNAME(nxgl_copyrectangle,NXGLIB_SUFFIX)
/* Then copy the image */
sline = (const uint8_t*)src + NXGL_SCALEX(dest->pt1.x - origin->x) + (dest->pt1.y - origin->y) * srcstride;
sline = (FAR const uint8_t *)src + NXGL_SCALEX(dest->pt1.x - origin->x) + (dest->pt1.y - origin->y) * srcstride;
dline = pinfo->fbmem + dest->pt1.y * deststride + NXGL_SCALEX(dest->pt1.x);
while (rows--)
@@ -171,7 +171,7 @@ void NXGL_FUNCNAME(nxgl_copyrectangle,NXGLIB_SUFFIX)
#else
/* Copy the whole line */
NXGL_MEMCPY((NXGL_PIXEL_T*)dline, (NXGL_PIXEL_T*)sline, width);
NXGL_MEMCPY((NXGL_PIXEL_T *)dline, (NXGL_PIXEL_T *)sline, width);
#endif
dline += deststride;
sline += srcstride;
+1 -1
View File
@@ -82,7 +82,7 @@
*
****************************************************************************/
void NXGL_FUNCNAME(nxgl_fillrectangle,NXGLIB_SUFFIX)
void NXGL_FUNCNAME(nxgl_fillrectangle, NXGLIB_SUFFIX)
(FAR struct fb_planeinfo_s *pinfo,
FAR const struct nxgl_rect_s *rect,
NXGL_PIXEL_T color)
+1 -1
View File
@@ -70,7 +70,7 @@
*
****************************************************************************/
void NXGL_FUNCNAME(nxgl_filltrapezoid,NXGLIB_SUFFIX)(
void NXGL_FUNCNAME(nxgl_filltrapezoid, NXGLIB_SUFFIX)(
FAR struct fb_planeinfo_s *pinfo,
FAR const struct nxgl_trapezoid_s *trap,
FAR const struct nxgl_rect_s *bounds,
+1 -1
View File
@@ -127,7 +127,7 @@ static inline void nxgl_lowresmemcpy(FAR uint8_t *dline, FAR const uint8_t *slin
*
****************************************************************************/
void NXGL_FUNCNAME(nxgl_getrectangle,NXGLIB_SUFFIX)
void NXGL_FUNCNAME(nxgl_getrectangle, NXGLIB_SUFFIX)
(FAR struct fb_planeinfo_s *pinfo, FAR const struct nxgl_rect_s *rect,
FAR void *dest, unsigned int deststride)
{
+1 -1
View File
@@ -84,7 +84,7 @@
*
****************************************************************************/
void NXGL_FUNCNAME(nxgl_setpixel,NXGLIB_SUFFIX)
void NXGL_FUNCNAME(nxgl_setpixel, NXGLIB_SUFFIX)
(FAR struct fb_planeinfo_s *pinfo,
FAR const struct nxgl_point_s *pos,
NXGL_PIXEL_T color)
+3 -3
View File
@@ -81,7 +81,7 @@
*
****************************************************************************/
void NXGL_FUNCNAME(nxgl_copyrectangle,NXGLIB_SUFFIX)
void NXGL_FUNCNAME(nxgl_copyrectangle, NXGLIB_SUFFIX)
(FAR struct lcd_planeinfo_s *pinfo, FAR const struct nxgl_rect_s *dest,
FAR const void *src, FAR const struct nxgl_point_s *origin,
unsigned int srcstride)
@@ -103,7 +103,7 @@ void NXGL_FUNCNAME(nxgl_copyrectangle,NXGLIB_SUFFIX)
/* Set up to copy the image */
xoffset = dest->pt1.x - origin->x;
sline = (const uint8_t*)src + NXGL_SCALEX(xoffset) + (dest->pt1.y - origin->y) * srcstride;
sline = (FAR const uint8_t *)src + NXGL_SCALEX(xoffset) + (dest->pt1.y - origin->y) * srcstride;
#if NXGLIB_BITSPERPIXEL < 8
remainder = NXGL_REMAINDERX(xoffset);
#endif
@@ -119,7 +119,7 @@ void NXGL_FUNCNAME(nxgl_copyrectangle,NXGLIB_SUFFIX)
if (remainder != 0)
{
NXGL_FUNCNAME(nxgl_copyrun,NXGLIB_SUFFIX)(sline, pinfo->buffer, remainder, ncols);
NXGL_FUNCNAME(nxgl_copyrun, NXGLIB_SUFFIX)(sline, pinfo->buffer, remainder, ncols);
(void)pinfo->putrun(row, dest->pt1.x, pinfo->buffer, ncols);
}
else
+2 -2
View File
@@ -84,7 +84,7 @@
*
****************************************************************************/
void NXGL_FUNCNAME(nxgl_fillrectangle,NXGLIB_SUFFIX)
void NXGL_FUNCNAME(nxgl_fillrectangle, NXGLIB_SUFFIX)
(FAR struct lcd_planeinfo_s *pinfo,
FAR const struct nxgl_rect_s *rect,
NXGL_PIXEL_T color)
@@ -98,7 +98,7 @@ void NXGL_FUNCNAME(nxgl_fillrectangle,NXGLIB_SUFFIX)
/* Fill the run buffer with the selected color */
NXGL_FUNCNAME(nxgl_fillrun,NXGLIB_SUFFIX)((NXGLIB_RUNTYPE*)pinfo->buffer, color, ncols);
NXGL_FUNCNAME(nxgl_fillrun, NXGLIB_SUFFIX)((NXGLIB_RUNTYPE *)pinfo->buffer, color, ncols);
/* Then fill the rectangle line-by-line */
+2 -2
View File
@@ -86,7 +86,7 @@
*
****************************************************************************/
void NXGL_FUNCNAME(nxgl_filltrapezoid,NXGLIB_SUFFIX)
void NXGL_FUNCNAME(nxgl_filltrapezoid, NXGLIB_SUFFIX)
(FAR struct lcd_planeinfo_s *pinfo,
FAR const struct nxgl_trapezoid_s *trap,
FAR const struct nxgl_rect_s *bounds,
@@ -215,7 +215,7 @@ void NXGL_FUNCNAME(nxgl_filltrapezoid,NXGLIB_SUFFIX)
ncols = botw;
}
NXGL_FUNCNAME(nxgl_fillrun,NXGLIB_SUFFIX)((NXGLIB_RUNTYPE*)pinfo->buffer, color, ncols);
NXGL_FUNCNAME(nxgl_fillrun, NXGLIB_SUFFIX)((NXGLIB_RUNTYPE *)pinfo->buffer, color, ncols);
/* Then fill the trapezoid row-by-row */
+1 -1
View File
@@ -79,7 +79,7 @@
*
****************************************************************************/
void NXGL_FUNCNAME(nxgl_getrectangle,NXGLIB_SUFFIX)
void NXGL_FUNCNAME(nxgl_getrectangle, NXGLIB_SUFFIX)
(FAR struct lcd_planeinfo_s *pinfo, FAR const struct nxgl_rect_s *rect,
FAR void *dest, unsigned int deststride)
{
+1 -1
View File
@@ -81,7 +81,7 @@
*
****************************************************************************/
void NXGL_FUNCNAME(nxgl_moverectangle,NXGLIB_SUFFIX)
void NXGL_FUNCNAME(nxgl_moverectangle, NXGLIB_SUFFIX)
(FAR struct lcd_planeinfo_s *pinfo, FAR const struct nxgl_rect_s *rect,
FAR struct nxgl_point_s *offset)
{
+1 -1
View File
@@ -85,7 +85,7 @@
*
****************************************************************************/
void NXGL_FUNCNAME(nxgl_setpixel,NXGLIB_SUFFIX)
void NXGL_FUNCNAME(nxgl_setpixel, NXGLIB_SUFFIX)
(FAR struct lcd_planeinfo_s *pinfo,
FAR const struct nxgl_point_s *pos,
NXGL_PIXEL_T color)
+3 -3
View File
@@ -214,7 +214,7 @@ static inline int nxmu_setup(FAR const char *mqname, FAR NX_DRIVERTYPE *dev,
attr.mq_msgsize = NX_MXSVRMSGLEN;
attr.mq_flags = 0;
fe->conn.crdmq = mq_open(mqname, O_RDONLY|O_CREAT, 0666, &attr);
fe->conn.crdmq = mq_open(mqname, O_RDONLY | O_CREAT, 0666, &attr);
if (fe->conn.crdmq == (mqd_t)-1)
{
gdbg("mq_open(%s) failed: %d\n", mqname, errno);
@@ -245,7 +245,7 @@ static inline int nxmu_setup(FAR const char *mqname, FAR NX_DRIVERTYPE *dev,
/* Initialize the non-NULL elements of the background window */
fe->be.bkgd.conn = &fe->conn;
fe->be.bkgd.be = (FAR struct nxbe_state_s*)fe;
fe->be.bkgd.be = (FAR struct nxbe_state_s *)fe;
fe->be.bkgd.bounds.pt2.x = fe->be.vinfo.xres - 1;
fe->be.bkgd.bounds.pt2.y = fe->be.vinfo.yres - 1;
@@ -325,7 +325,7 @@ int nx_runinstance(FAR const char *mqname, FAR NX_DRIVERTYPE *dev)
/* Then loop forever processing incoming messages */
for (;;)
for (; ; )
{
/* Receive the next server message */
+1 -1
View File
@@ -311,7 +311,7 @@ nxterm_renderglyph(FAR struct nxterm_state_s *priv,
/* Then render the glyph into the allocated memory */
ret = RENDERER((FAR nxgl_mxpixel_t*)glyph->bitmap,
ret = RENDERER((FAR nxgl_mxpixel_t *)glyph->bitmap,
glyph->height, glyph->width, glyph->stride,
fbm, priv->wndo.fcolor[0]);
if (ret < 0)
+1 -1
View File
@@ -96,7 +96,7 @@ FAR struct nxterm_state_s *
priv->ops = ops;
priv->handle = handle;
priv->minor = minor;
memcpy(&priv->wndo, wndo, sizeof( struct nxterm_window_s));
memcpy(&priv->wndo, wndo, sizeof(struct nxterm_window_s));
sem_init(&priv->exclsem, 0, 1);
#ifdef CONFIG_DEBUG
+1 -1
View File
@@ -136,7 +136,7 @@ static inline void nxterm_movedisplay(FAR struct nxterm_state_s *priv,
/* Finally, clear the vacated part of the display */
rect.pt1.y = bottom;
rect.pt2.y = priv->wndo.wsize.h- 1;
rect.pt2.y = priv->wndo.wsize.h - 1;
ret = priv->ops->fill(priv, &rect, priv->wndo.wcolor);
if (ret < 0)
+1 -1
View File
@@ -127,7 +127,7 @@ gran_common_initialize(FAR void *heapstart, size_t heapsize, uint8_t log2gran,
* correct size.
*/
priv = ( FAR struct gran_s *)kmm_zalloc(SIZEOF_GRAN_S(ngranules));
priv = (FAR struct gran_s *)kmm_zalloc(SIZEOF_GRAN_S(ngranules));
if (priv)
{
/* Initialize non-zero elements of the granules heap info structure */
+1 -1
View File
@@ -100,7 +100,7 @@ void gran_mark_allocated(FAR struct gran_s *priv, uintptr_t alloc,
{
/* Mark bits in the first GAT entry */
gatmask =0xffffffff << gatbit;
gatmask = 0xffffffff << gatbit;
DEBUGASSERT((priv->gat[gatidx] & gatmask) == 0);
priv->gat[gatidx] |= gatmask;
+2 -2
View File
@@ -208,9 +208,9 @@ uintptr_t mm_pgalloc(unsigned int npages)
void mm_pgfree(uintptr_t paddr, unsigned int npages)
{
#ifdef CONFIG_GRAN_SINGLE
gran_free((FAR void*)paddr, (size_t)npages << MM_PGSHIFT);
gran_free((FAR void *)paddr, (size_t)npages << MM_PGSHIFT);
#else
gran_free(g_pgalloc, (FAR void*)paddr, (size_t)npages << MM_PGSHIFT);
gran_free(g_pgalloc, (FAR void *)paddr, (size_t)npages << MM_PGSHIFT);
#endif
}
+4 -4
View File
@@ -88,12 +88,12 @@ void mm_free(FAR struct mm_heap_s *heap, FAR void *mem)
/* Map the memory chunk into a free node */
node = (FAR struct mm_freenode_s *)((char*)mem - SIZEOF_MM_ALLOCNODE);
node = (FAR struct mm_freenode_s *)((FAR char *)mem - SIZEOF_MM_ALLOCNODE);
node->preceding &= ~MM_ALLOC_BIT;
/* Check if the following node is free and, if so, merge it */
next = (FAR struct mm_freenode_s *)((char*)node + node->size);
next = (FAR struct mm_freenode_s *)((FAR char *)node + node->size);
if ((next->preceding & MM_ALLOC_BIT) == 0)
{
FAR struct mm_allocnode_s *andbeyond;
@@ -103,7 +103,7 @@ void mm_free(FAR struct mm_heap_s *heap, FAR void *mem)
* index past the tail chunk because it is always allocated.
*/
andbeyond = (FAR struct mm_allocnode_s*)((char*)next + next->size);
andbeyond = (FAR struct mm_allocnode_s *)((FAR char *)next + next->size);
/* Remove the next node. There must be a predecessor,
* but there may not be a successor node.
@@ -127,7 +127,7 @@ void mm_free(FAR struct mm_heap_s *heap, FAR void *mem)
* it with this node
*/
prev = (FAR struct mm_freenode_s *)((char*)node - node->preceding);
prev = (FAR struct mm_freenode_s *)((FAR char *)node - node->preceding);
if ((prev->preceding & MM_ALLOC_BIT) == 0)
{
/* Remove the node. There must be a predecessor, but there may
+2 -2
View File
@@ -71,7 +71,7 @@
int mm_mallinfo(FAR struct mm_heap_s *heap, FAR struct mallinfo *info)
{
struct mm_allocnode_s *node;
FAR struct mm_allocnode_s *node;
size_t mxordblk = 0;
int ordblks = 0; /* Number of non-inuse chunks */
size_t uordblks = 0; /* Total allocated space */
@@ -98,7 +98,7 @@ int mm_mallinfo(FAR struct mm_heap_s *heap, FAR struct mallinfo *info)
for (node = heap->mm_heapstart[region];
node < heap->mm_heapend[region];
node = (struct mm_allocnode_s *)((char*)node + node->size))
node = (FAR struct mm_allocnode_s *)((FAR char *)node + node->size))
{
mvdbg("region=%d node=%p size=%p preceding=%p (%c)\n",
region, node, node->size, (node->preceding & ~MM_ALLOC_BIT),
+4 -4
View File
@@ -49,7 +49,7 @@
****************************************************************************/
#ifndef NULL
# define NULL ((void*)0)
# define NULL ((void *)0)
#endif
/****************************************************************************
@@ -164,11 +164,11 @@ FAR void *mm_malloc(FAR struct mm_heap_s *heap, size_t size)
{
/* Get a pointer to the next node in physical memory */
next = (FAR struct mm_freenode_s*)(((char*)node) + node->size);
next = (FAR struct mm_freenode_s *)(((FAR char *)node) + node->size);
/* Create the remainder node */
remainder = (FAR struct mm_freenode_s*)(((char*)node) + size);
remainder = (FAR struct mm_freenode_s *)(((FAR char *)node) + size);
remainder->size = remaining;
remainder->preceding = size;
@@ -190,7 +190,7 @@ FAR void *mm_malloc(FAR struct mm_heap_s *heap, size_t size)
/* Handle the case of an exact size match */
node->preceding |= MM_ALLOC_BIT;
ret = (void*)((char*)node + SIZEOF_MM_ALLOCNODE);
ret = (void *)((FAR char *)node + SIZEOF_MM_ALLOCNODE);
}
mm_givesemaphore(heap);
+5 -5
View File
@@ -119,7 +119,7 @@ FAR void *mm_memalign(FAR struct mm_heap_s *heap, size_t alignment,
* the allocation.
*/
node = (FAR struct mm_allocnode_s*)(rawchunk - SIZEOF_MM_ALLOCNODE);
node = (FAR struct mm_allocnode_s *)(rawchunk - SIZEOF_MM_ALLOCNODE);
/* Find the aligned subregion */
@@ -135,7 +135,7 @@ FAR void *mm_memalign(FAR struct mm_heap_s *heap, size_t alignment,
/* Get the node the next node after the allocation. */
next = (FAR struct mm_allocnode_s*)((char*)node + node->size);
next = (FAR struct mm_allocnode_s *)((FAR char *)node + node->size);
/* Make sure that there is space to convert the preceding mm_allocnode_s
* into an mm_freenode_s. I think that this should always be true
@@ -143,7 +143,7 @@ FAR void *mm_memalign(FAR struct mm_heap_s *heap, size_t alignment,
DEBUGASSERT(alignedchunk >= rawchunk + 8);
newnode = (FAR struct mm_allocnode_s*)(alignedchunk - SIZEOF_MM_ALLOCNODE);
newnode = (FAR struct mm_allocnode_s *)(alignedchunk - SIZEOF_MM_ALLOCNODE);
/* Preceding size is full size of the new 'node,' including
* SIZEOF_MM_ALLOCNODE
@@ -162,7 +162,7 @@ FAR void *mm_memalign(FAR struct mm_heap_s *heap, size_t alignment,
if (precedingsize < SIZEOF_MM_FREENODE)
{
alignedchunk += alignment;
newnode = (FAR struct mm_allocnode_s*)(alignedchunk - SIZEOF_MM_ALLOCNODE);
newnode = (FAR struct mm_allocnode_s *)(alignedchunk - SIZEOF_MM_ALLOCNODE);
precedingsize = (size_t)newnode - (size_t)node;
}
@@ -210,5 +210,5 @@ FAR void *mm_memalign(FAR struct mm_heap_s *heap, size_t alignment,
}
mm_givesemaphore(heap);
return (FAR void*)alignedchunk;
return (FAR void *)alignedchunk;
}
+8 -8
View File
@@ -115,7 +115,7 @@ FAR void *mm_realloc(FAR struct mm_heap_s *heap, FAR void *oldmem,
/* Map the memory chunk into an allocated node structure */
oldnode = (FAR struct mm_allocnode_s *)((FAR char*)oldmem - SIZEOF_MM_ALLOCNODE);
oldnode = (FAR struct mm_allocnode_s *)((FAR char *)oldmem - SIZEOF_MM_ALLOCNODE);
/* We need to hold the MM semaphore while we muck with the nodelist. */
@@ -146,13 +146,13 @@ FAR void *mm_realloc(FAR struct mm_heap_s *heap, FAR void *oldmem,
* best decision
*/
next = (FAR struct mm_freenode_s *)((FAR char*)oldnode + oldnode->size);
next = (FAR struct mm_freenode_s *)((FAR char *)oldnode + oldnode->size);
if ((next->preceding & MM_ALLOC_BIT) == 0)
{
nextsize = next->size;
}
prev = (FAR struct mm_freenode_s *)((FAR char*)oldnode - (oldnode->preceding & ~MM_ALLOC_BIT));
prev = (FAR struct mm_freenode_s *)((FAR char *)oldnode - (oldnode->preceding & ~MM_ALLOC_BIT));
if ((prev->preceding & MM_ALLOC_BIT) == 0)
{
prevsize = prev->size;
@@ -240,7 +240,7 @@ FAR void *mm_realloc(FAR struct mm_heap_s *heap, FAR void *oldmem,
/* Extend the node into the previous free chunk */
newnode = (FAR struct mm_allocnode_s *)((FAR char*)oldnode - takeprev);
newnode = (FAR struct mm_allocnode_s *)((FAR char *)oldnode - takeprev);
/* Did we consume the entire preceding chunk? */
@@ -277,7 +277,7 @@ FAR void *mm_realloc(FAR struct mm_heap_s *heap, FAR void *oldmem,
* should be save for this.
*/
newmem = (FAR void*)((FAR char*)newnode + SIZEOF_MM_ALLOCNODE);
newmem = (FAR void *)((FAR char *)newnode + SIZEOF_MM_ALLOCNODE);
memcpy(newmem, oldmem, oldsize - SIZEOF_MM_ALLOCNODE);
}
@@ -292,7 +292,7 @@ FAR void *mm_realloc(FAR struct mm_heap_s *heap, FAR void *oldmem,
* chunk)
*/
andbeyond = (FAR struct mm_allocnode_s*)((char*)next + nextsize);
andbeyond = (FAR struct mm_allocnode_s *)((FAR char *)next + nextsize);
/* Remove the next node. There must be a predecessor, but there
* may not be a successor node.
@@ -308,7 +308,7 @@ FAR void *mm_realloc(FAR struct mm_heap_s *heap, FAR void *oldmem,
/* Extend the node into the next chunk */
oldnode->size = oldsize + takenext;
newnode = (FAR struct mm_freenode_s *)((char*)oldnode + oldnode->size);
newnode = (FAR struct mm_freenode_s *)((FAR char *)oldnode + oldnode->size);
/* Did we consume the entire preceding chunk? */
@@ -347,7 +347,7 @@ FAR void *mm_realloc(FAR struct mm_heap_s *heap, FAR void *oldmem,
*/
mm_givesemaphore(heap);
newmem = (FAR void*)mm_malloc(heap, size);
newmem = (FAR void *)mm_malloc(heap, size);
if (newmem)
{
memcpy(newmem, oldmem, oldsize);
+1 -1
View File
@@ -75,7 +75,7 @@
* heap - A reference to the data structure that defines this heap.
* incr - Specifies the number of bytes to add or to remove from the
* space allocated for the process.
maxbreak - The maximum permissible break address.
* maxbreak - The maximum permissible break address.
*
* Returned Value:
* Upon successful completion, sbrk() returns the prior break value.
+4 -4
View File
@@ -73,7 +73,7 @@ void mm_shrinkchunk(FAR struct mm_heap_s *heap,
/* Get a reference to the next node */
next = (FAR struct mm_freenode_s*)((char*)node + node->size);
next = (FAR struct mm_freenode_s *)((FAR char *)node + node->size);
/* Check if it is free */
@@ -84,7 +84,7 @@ void mm_shrinkchunk(FAR struct mm_heap_s *heap,
/* Get the chunk next the next node (which could be the tail chunk) */
andbeyond = (FAR struct mm_allocnode_s*)((char*)next + next->size);
andbeyond = (FAR struct mm_allocnode_s *)((FAR char *)next + next->size);
/* Remove the next node. There must be a predecessor, but there may
* not be a successor node.
@@ -101,7 +101,7 @@ void mm_shrinkchunk(FAR struct mm_heap_s *heap,
* tailing memory from the aligned chunk.
*/
newnode = (FAR struct mm_freenode_s*)((char*)node + size);
newnode = (FAR struct mm_freenode_s *)((FAR char *)node + size);
/* Set up the size of the new node */
@@ -127,7 +127,7 @@ void mm_shrinkchunk(FAR struct mm_heap_s *heap,
* tailing memory from the aligned chunk.
*/
newnode = (FAR struct mm_freenode_s*)((char*)node + size);
newnode = (FAR struct mm_freenode_s *)((FAR char *)node + size);
/* Set up the size of the new node */