Mercurial > hg > octave-lojdl > gnulib-hg
annotate lib/spawn_faction_init.c @ 16511:2074f2bf7216
math code: Add comments.
* lib/acosl.c: Add comment about related glibc source files.
* lib/asinl.c: Likewise.
* lib/atanl.c: Likewise.
* lib/expl.c: Likewise.
* lib/logl.c: Likewise.
* lib/sincosl.c: Likewise.
* lib/sinl.c: Likewise.
* lib/tanl.c: Likewise.
* lib/trigl.c: Likewise.
* lib/cosl.c: Likewise. Fix comments.
author | Bruno Haible <bruno@clisp.org> |
---|---|
date | Wed, 29 Feb 2012 12:30:07 +0100 |
parents | 18a38c9615f0 |
children | e542fd46ad6f |
rev | line source |
---|---|
16201
8250f2777afc
maint: update all copyright year number ranges
Jim Meyering <meyering@redhat.com>
parents:
14079
diff
changeset
|
1 /* Copyright (C) 2000, 2009-2012 Free Software Foundation, Inc. |
10506
989d25db0548
New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2 This file is part of the GNU C Library. |
989d25db0548
New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3 |
989d25db0548
New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4 This program is free software: you can redistribute it and/or modify |
989d25db0548
New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5 it under the terms of the GNU General Public License as published by |
989d25db0548
New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6 the Free Software Foundation; either version 3 of the License, or |
989d25db0548
New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
7 (at your option) any later version. |
989d25db0548
New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
8 |
989d25db0548
New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
9 This program is distributed in the hope that it will be useful, |
989d25db0548
New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
10 but WITHOUT ANY WARRANTY; without even the implied warranty of |
989d25db0548
New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
989d25db0548
New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
12 GNU General Public License for more details. |
989d25db0548
New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
13 |
989d25db0548
New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
14 You should have received a copy of the GNU General Public License |
989d25db0548
New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
15 along with this program. If not, see <http://www.gnu.org/licenses/>. */ |
989d25db0548
New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
16 |
989d25db0548
New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
17 #include <config.h> |
989d25db0548
New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
18 |
989d25db0548
New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
19 /* Specification. */ |
989d25db0548
New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
20 #include <spawn.h> |
989d25db0548
New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
21 |
989d25db0548
New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
22 #include <errno.h> |
989d25db0548
New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
23 #include <stdlib.h> |
989d25db0548
New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
24 #include <string.h> |
989d25db0548
New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
25 |
989d25db0548
New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
26 #include "spawn_int.h" |
989d25db0548
New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
27 |
989d25db0548
New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
28 |
989d25db0548
New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
29 /* Function used to increase the size of the allocated array. This |
16235
18a38c9615f0
In commentary, do not use ` to quote.
Paul Eggert <eggert@cs.ucla.edu>
parents:
16201
diff
changeset
|
30 function is called from the 'add'-functions. */ |
10506
989d25db0548
New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
31 int |
989d25db0548
New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
32 __posix_spawn_file_actions_realloc (posix_spawn_file_actions_t *file_actions) |
989d25db0548
New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
33 { |
989d25db0548
New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
34 int newalloc = file_actions->_allocated + 8; |
989d25db0548
New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
35 void *newmem = realloc (file_actions->_actions, |
12421
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
10506
diff
changeset
|
36 newalloc * sizeof (struct __spawn_action)); |
10506
989d25db0548
New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
37 |
989d25db0548
New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
38 if (newmem == NULL) |
989d25db0548
New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
39 /* Not enough memory. */ |
989d25db0548
New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
40 return ENOMEM; |
989d25db0548
New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
41 |
989d25db0548
New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
42 file_actions->_actions = (struct __spawn_action *) newmem; |
989d25db0548
New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
43 file_actions->_allocated = newalloc; |
989d25db0548
New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
44 |
989d25db0548
New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
45 return 0; |
989d25db0548
New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
46 } |
989d25db0548
New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
47 |
989d25db0548
New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
48 |
16235
18a38c9615f0
In commentary, do not use ` to quote.
Paul Eggert <eggert@cs.ucla.edu>
parents:
16201
diff
changeset
|
49 /* Initialize data structure for file attribute for 'spawn' call. */ |
10506
989d25db0548
New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
50 int |
989d25db0548
New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
51 posix_spawn_file_actions_init (posix_spawn_file_actions_t *file_actions) |
989d25db0548
New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
52 { |
989d25db0548
New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
53 /* Simply clear all the elements. */ |
989d25db0548
New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
54 memset (file_actions, '\0', sizeof (*file_actions)); |
989d25db0548
New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
55 return 0; |
989d25db0548
New module 'posix_spawn_file_actions_init'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
56 } |