~ubuntu-branches/ubuntu/lucid/python-scipy/lucid

« back to all changes in this revision

Viewing changes to Lib/sandbox/xplt/src/play/all/pmemcpy.c

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2007-01-07 14:12:12 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20070107141212-mm0ebkh5b37hcpzn
* Remove build dependency on python-numpy-dev.
* python-scipy: Depend on python-numpy instead of python-numpy-dev.
* Package builds on other archs than i386. Closes: #402783.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * pmemcpy.c -- $Id: pmemcpy.c 685 2003-03-08 15:26:51Z travo $
 
3
 * memcpy that p_mallocs its destination
 
4
 *
 
5
 * Copyright (c) 1998.  See accompanying LEGAL file for details.
 
6
 */
 
7
 
 
8
#include "config.h"
 
9
#include "pstdlib.h"
 
10
#include <string.h>
 
11
 
 
12
void *
 
13
p_memcpy(const void *s, size_t n)
 
14
{
 
15
  if (s) {
 
16
    void *d = p_malloc(n);
 
17
    if ( ! (((char *)s-(char *)0) & (sizeof(size_t)-1)) ) {
 
18
      /* some versions of memcpy miss this obvious optimization */
 
19
      const size_t *sl=s;
 
20
      size_t *dl=d;
 
21
      while (n>=sizeof(size_t)) {
 
22
        *(dl++)= *(sl++);
 
23
        n -= sizeof(size_t);
 
24
      }
 
25
    }
 
26
    if (n) memcpy(d, s, n);
 
27
    return d;
 
28
  } else {
 
29
    return 0;
 
30
  }
 
31
}