]> git.sur5r.net Git - glabels/blob - libglabels/lgl-vendor.c
Upload to unstable
[glabels] / libglabels / lgl-vendor.c
1 /*
2  *  lgl-vendor.c
3  *  Copyright (C) 2003-2010  Jim Evins <evins@snaught.com>.
4  *
5  *  This file is part of libglabels.
6  *
7  *  libglabels is free software: you can redistribute it and/or modify
8  *  it under the terms of the GNU Lesser General Public License as published by
9  *  the Free Software Foundation, either version 3 of the License, or
10  *  (at your option) any later version.
11  *
12  *  libglabels is distributed in the hope that it will be useful,
13  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  *  GNU Lesser General Public License for more details.
16  *
17  *  You should have received a copy of the GNU Lesser General Public License
18  *  along with libglabels.  If not, see <http://www.gnu.org/licenses/>.
19  */
20
21 #include <config.h>
22
23 #include "lgl-vendor.h"
24
25 #include <glib/gi18n.h>
26 #include <glib.h>
27 #include <string.h>
28
29 #include "libglabels-private.h"
30
31 /*===========================================*/
32 /* Private types                             */
33 /*===========================================*/
34
35
36 /*===========================================*/
37 /* Private globals                           */
38 /*===========================================*/
39
40
41 /*===========================================*/
42 /* Local function prototypes                 */
43 /*===========================================*/
44
45
46 /*===========================================*/
47 /* Functions.                                */
48 /*===========================================*/
49
50 /**
51  * lgl_vendor_new:
52  * @name:     Localized name of vendor.
53  *
54  * Allocates and constructs a new #lglVendor structure.
55  *
56  * Returns: a pointer to a newly allocated #lglVendor structure.
57  *
58  */
59 lglVendor *
60 lgl_vendor_new (gchar             *name)
61 {
62         lglVendor *vendor;
63
64         vendor           = g_new0 (lglVendor,1);
65
66         vendor->name     = g_strdup (name);
67
68         return vendor;
69 }
70
71
72 /**
73  * lgl_vendor_dup:
74  * @orig:  #lglVendor structure to be duplicated.
75  *
76  * Duplicates an existing #lglVendor structure.
77  *
78  * Returns: a pointer to a newly allocated #lglVendor structure.
79  *
80  */
81 lglVendor *lgl_vendor_dup (const lglVendor *orig)
82 {
83         lglVendor       *vendor;
84
85         g_return_val_if_fail (orig, NULL);
86
87         vendor = g_new0 (lglVendor,1);
88
89         vendor->name  = g_strdup (orig->name);
90         vendor->url   = g_strdup (orig->url);
91
92         return vendor;
93 }
94
95
96 /**
97  * lgl_vendor_free:
98  * @vendor:  pointer to #lglVendor structure to be freed.
99  *
100  * Free all memory associated with an existing #lglVendor structure.
101  *
102  */
103 void lgl_vendor_free (lglVendor *vendor)
104 {
105
106         if ( vendor != NULL )
107         {
108                 g_free (vendor->name);
109                 vendor->name = NULL;
110
111                 g_free (vendor->url);
112                 vendor->url = NULL;
113
114                 g_free (vendor);
115         }
116
117 }
118
119
120
121 /*
122  * Local Variables:       -- emacs
123  * mode: C                -- emacs
124  * c-basic-offset: 8      -- emacs
125  * tab-width: 8           -- emacs
126  * indent-tabs-mode: nil  -- emacs
127  * End:                   -- emacs
128  */