Changeset dae85e8 in git


Ignore:
Timestamp:
2013-11-08T07:21:40Z (6 years ago)
Author:
Xuefer <xuefer@…>
Branches:
master, trunk
Children:
11bb4f0
Parents:
eaa50fb
Message:

improve readability using ptradd

git-svn-id: svn://svn.lighttpd.net/xcache/trunk@1452 c26eb9a1-5813-0410-bd6c-c2e55f420ca7

Location:
processor
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • processor/foot.m4

    r45e2bfe rdae85e8  
    136136}
    137137dnl }}}
    138 #define ptradd(type, ptr, ptrdiff) ((type) ((char *) (ptr) + (ptrdiff)))
    139 #define ptrsub(ptr1, ptr2) ((char *) (ptr1) - (char *)(ptr2))
    140138define(`DEFINE_RELOCATE_API', `
    141139EXPORTED_FUNCTION(`void xc_processor_relocate_$1($1 *old_src, $1 *old_start, $1 *new_src, $1 *new_start TSRMLS_DC)') dnl {{{
     
    149147    ptrdiff_t ptrdiff = (ptrdiff_t) new_address;
    150148    ptrdiff_t relocatediff = (ptrdiff_t) ptradd($1 *, new_start, offset);
     149    assert(new_src == ptradd($1 *, old_src, ptrdiff));
    151150
    152151    xc_relocate_$1(new_src, ptrdiff, relocatediff TSRMLS_CC);
  • processor/head.m4

    r6413478 rdae85e8  
    8181
    8282#define MAX_DUP_STR_LEN 256
     83
     84#define ptradd(type, ptr, ptrdiff) ((type) (((char *) (ptr)) + (ptrdiff)))
     85#define ptrsub(ptr1, ptr2) (((char *) (ptr1)) - ((char *) (ptr2)))
    8386dnl }}}
    8487dnl {{{ _xc_processor_t
  • processor/main.m4

    r0174691 rdae85e8  
    2626dnl }}}
    2727dnl {{{ SRCPTR_EX(1:type, 2:elm)
    28 define(`SRCPTR_EX', `IFRELOCATE(`(($1 *) (((char *) $2) + ptrdiff))', `$2')')
     28define(`SRCPTR_EX', `IFRELOCATE(`ptradd($1 *, $2, ptrdiff)', `$2')')
    2929dnl }}}
    3030dnl {{{ ALLOC(1:dst, 2:type, 3:count=1, 4:clean=false, 5:realtype=$2)
Note: See TracChangeset for help on using the changeset viewer.