Allow overlapping sync and async startup requests
[chromium-blink-merge.git] / chrome / test / pyautolib / argc_argv.i
blobb705006ad989d693add8cbb8b55bf624b2e3344f
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 //
5 // Make functions using (int argc, char** argv) usable as (sys.argv) from python
7 %typemap(in) (int argc, char **argv) {
8 int i;
9 if (!PyList_Check($input)) {
10 PyErr_SetString(PyExc_ValueError, "Expecting a list");
11 return NULL;
13 $1 = PyList_Size($input);
14 $2 = (char **) malloc(($1+1)*sizeof(char *));
15 for (i = 0; i < $1; i++) {
16 PyObject *s = PyList_GetItem($input,i);
17 if (!PyString_Check(s)) {
18 free($2);
19 PyErr_SetString(PyExc_ValueError, "List items must be strings");
20 return NULL;
22 $2[i] = PyString_AsString(s);
24 $2[i] = 0;
27 %typemap(freearg) (int argc, char **argv) {
28 if ($2) free($2);