summaryrefslogtreecommitdiffstats
path: root/docs/nspr/reference/pr_popiolayer.rst
blob: 42fae4c0741cb659710321ad50640afe30e4c191 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
PR_PopIOLayer
=============

Removes a layer from the stack.


Syntax
------

.. code::

   #include <prio.h>

   PRFileDesc *PR_PopIOLayer(
     PRFileDesc *stack,
     PRDescIdentity id);


Parameters
~~~~~~~~~~

The function has the following parameters:

``stack``
   A pointer to a :ref:`PRFileDesc` object representing the stack from
   which the specified layer is to be removed.
``id``
   Identity of the layer to be removed from the stack.


Returns
~~~~~~~

The function returns one of the following values:

-  If the layer is successfully removed from the stack, a pointer to the
   removed layer.
-  If the layer is not found in the stack or cannot be popped (for
   example, the bottommost layer), the function returns ``NULL`` with
   the error code ``PR_INVALID_ARGUMENT_ERROR``.


Description
-----------

:ref:`PR_PopIOLayer` pops the specified layer from the stack. If the object
to be removed is found, :ref:`PR_PopIOLayer` returns a pointer to the
removed object The object then becomes the responsibility of the caller.

Even if the identity indicates the top layer of the stack, the reference
returned is not the file descriptor for the stack and that file
descriptor remains valid. In other words, ``stack`` continues to point
to the top of the stack after the function returns.