~ubuntu-branches/ubuntu/quantal/m2crypto/quantal

« back to all changes in this revision

Viewing changes to SWIG/_rand.i

  • Committer: Bazaar Package Importer
  • Author(s): Dima Barsky
  • Date: 2007-05-24 21:14:36 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20070524211436-73w3oonappxy8k4a
Tags: 0.17-1
* New upstream release
* Acknowledge NMU (Closes: #380861)
* Changed section to python (Closes: #425875)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
2
/* Copyright (c) 1999-2004 Ng Pheng Siong. All rights reserved. */
3
 
/* $Id: _rand.i 372 2006-03-08 19:56:46Z heikki $ */
 
3
/* $Id: _rand.i 447 2006-06-05 21:29:00Z heikki $ */
4
4
 
5
5
%module _rand
6
6
 
71
71
    unsigned char *blob;
72
72
    PyObject *tuple;
73
73
    
74
 
    if (!(blob=(unsigned char *)PyMem_Malloc(n)))
75
 
                return NULL;
 
74
    if (!(blob=(unsigned char *)PyMem_Malloc(n))) {
 
75
        PyErr_SetString(PyExc_MemoryError, "rand_pseudo_bytes");
 
76
        return NULL;
 
77
    }
76
78
    if (!(tuple=PyTuple_New(2))) {
77
79
        PyErr_SetString(PyExc_RuntimeError, "PyTuple_New() fails");
78
80
        PyMem_Free(blob);