1 /**********************************************************
2  *
3  * libmp3splt -- library based on mp3splt,
4  *               for mp3/ogg splitting without decoding
5  *
6  * Copyright (c) 2002-2005 M. Trotta - <mtrotta@users.sourceforge.net>
7  * Copyright (c) 2005-2014 Alexandru Munteanu - m@ioalex.net
8  *
9  * http://mp3splt.sourceforge.net
10  *
11  *********************************************************/
12 
13 /**********************************************************
14  *
15  * This program is free software; you can redistribute it and/or
16  * modify it under the terms of the GNU General Public License
17  * as published by the Free Software Foundation; either version 2
18  * of the License, or (at your option) any later version.
19  *
20  * This program is distributed in the hope that it will be useful,
21  * but WITHOUT ANY WARRANTY; without even the implied warranty of
22  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
23  * GNU General Public License for more details.
24  *
25  * You should have received a copy of the GNU General Public License
26  * along with this program; if not, write to the Free Software
27  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
28  * USA.
29  *
30  *********************************************************/
31 
32 /*! \file
33 
34 \todo What is a split pair?
35 */
36 #include "splt.h"
37 
splt_int_pair_new(int first,int second)38 splt_int_pair *splt_int_pair_new(int first, int second)
39 {
40   splt_int_pair *pair = malloc(sizeof(splt_int_pair));
41   if (pair == NULL)
42   {
43     return NULL;
44   }
45 
46   pair->first = first;
47   pair->second = second;
48 
49   return pair;
50 }
51 
splt_int_pair_free(splt_int_pair ** pair)52 void splt_int_pair_free(splt_int_pair **pair)
53 {
54   if (!pair)
55   {
56     return;
57   }
58 
59   if (!*pair)
60   {
61     return;
62   }
63 
64   free(*pair);
65   *pair = NULL;
66 }
67 
splt_int_pair_first(splt_int_pair * pair)68 int splt_int_pair_first(splt_int_pair *pair)
69 {
70   return pair->first;
71 }
72 
splt_int_pair_second(splt_int_pair * pair)73 int splt_int_pair_second(splt_int_pair *pair)
74 {
75   return pair->second;
76 }
77 
splt_il_pair_new(int first,long second)78 splt_il_pair *splt_il_pair_new(int first, long second)
79 {
80   splt_il_pair *pair = malloc(sizeof(splt_il_pair));
81   if (pair == NULL)
82   {
83     return NULL;
84   }
85 
86   pair->first = first;
87   pair->second = second;
88 
89   return pair;
90 }
91 
splt_il_pair_free(splt_il_pair ** pair)92 void splt_il_pair_free(splt_il_pair **pair)
93 {
94   if (!pair)
95   {
96     return;
97   }
98 
99   if (!*pair)
100   {
101     return;
102   }
103 
104   free(*pair);
105   *pair = NULL;
106 }
107 
splt_il_pair_first(splt_il_pair * pair)108 int splt_il_pair_first(splt_il_pair *pair)
109 {
110   return pair->first;
111 }
112 
splt_il_pair_second(splt_il_pair * pair)113 long splt_il_pair_second(splt_il_pair *pair)
114 {
115   return pair->second;
116 }
117 
118