Browse Source

Check if ont of parameters is null in ts_XXX_is_same()

Georgi Chorbadzhiyski 13 years ago
parent
commit
b401d8d3b5
3 changed files with 6 additions and 0 deletions
  1. 2
    0
      tsfuncs_cat.c
  2. 2
    0
      tsfuncs_pat.c
  3. 2
    0
      tsfuncs_pmt.c

+ 2
- 0
tsfuncs_cat.c View File

@@ -162,6 +162,8 @@ void ts_cat_dump(struct ts_cat *cat) {
162 162
 }
163 163
 
164 164
 int ts_cat_is_same(struct ts_cat *cat1, struct ts_cat *cat2) {
165
+	if (cat1 == cat2) return 1; // Same
166
+	if ((!cat1 && cat2) || (cat1 && !cat2)) return 0; // Not same (one is NULL)
165 167
 	return ts_section_is_same(cat1->section_header, cat2->section_header);
166 168
 }
167 169
 

+ 2
- 0
tsfuncs_pat.c View File

@@ -201,5 +201,7 @@ void ts_pat_dump(struct ts_pat *pat) {
201 201
 }
202 202
 
203 203
 int ts_pat_is_same(struct ts_pat *pat1, struct ts_pat *pat2) {
204
+	if (pat1 == pat2) return 1; // Same
205
+	if ((!pat1 && pat2) || (pat1 && !pat2)) return 0; // Not same (one is NULL)
204 206
 	return ts_section_is_same(pat1->section_header, pat2->section_header);
205 207
 }

+ 2
- 0
tsfuncs_pmt.c View File

@@ -265,5 +265,7 @@ void ts_pmt_dump(struct ts_pmt *pmt) {
265 265
 }
266 266
 
267 267
 int ts_pmt_is_same(struct ts_pmt *pmt1, struct ts_pmt *pmt2) {
268
+	if (pmt1 == pmt2) return 1; // Same
269
+	if ((!pmt1 && pmt2) || (pmt1 && !pmt2)) return 0; // Not same (one is NULL)
268 270
 	return ts_section_is_same(pmt1->section_header, pmt2->section_header);
269 271
 }

Loading…
Cancel
Save