This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

valloc vs memalign, MACOSX


    I'm not sure whether this forum is the place to ask this question,
but I really could not find a way around.
    I'm trying to compile a program for DNA analysis  in MACOSX (Darwin)
using g++, but it stopped with an error with memalign.  As far as I
understood,  this function is not implemented in  OSX, and I saw in a
webpage someone mentioning the use of valloc instead.
    I am not very well versed in c++, and so if someone can give me a
hint on how to change the code so that I can use valloc instead of
memalign since these functions have different number of parameters.

    I removed most of the code, leaving only the info relevant for the
memalign function.

    Thanks and sorry if this was not a relevant question for this forum


#define GB_MEMALIGN(a,b)         memalign(a,b)
#define GBM_MALLOC_OVERHEAD 32                     /* pointer for alloc
*/
#define GBM_TABLE_SIZE
(gbm_system_page_size-GBM_MALLOC_OVERHEAD)      /* 4k Tables */

                 if (ggi->size < nsize)
                {
                        struct gbm_table_struct *gts = (struct
gbm_table_struct
        *)GB_MEMALIGN(gbm_system_page_size, GBM_TABLE_SIZE);

                        if (!gts) { GB_memerr(); return NULL; }

                        memset((char *)gts,0,GBM_TABLE_SIZE);
                        ggi->gds = &gts->data[0];
                        gts->next = ggi->first; /* link tables */
                        ggi->first = gts;
                        ggi->size = GBM_TABLE_SIZE - sizeof(void *);
                        ggi->allsize += GBM_TABLE_SIZE;
                }

--
============================================================================

            oOOOOo                      Marcelino Suzuki
          oOOO              Monterey Bay Aquarium Research Institute
       oOOOOOo.          7700 Sandholdt Rd. Moss Landing, 95039-0628, CA

    .oOOOOOOOOOo.                      <suzuki@mbari.org>
  .oOOOOOOOOOOOOOOooo..          "http://www.mbari.org/~suzuki";
0000000000000000000000000000000000000000000000000000000000000000000000000000




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]