Skip to content

Commit cdca423

Browse files
committed
rm
1 parent 91e6a62 commit cdca423

File tree

1 file changed

+10
-43
lines changed

1 file changed

+10
-43
lines changed

libr/bin/format/pyc/marshal.c

Lines changed: 10 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -86,21 +86,16 @@ static ut8 *get_bytes(RBuffer *buffer, ut32 size) {
8686

8787
static pyc_object *get_none_object(void) {
8888
pyc_object *ret = R_NEW0 (pyc_object);
89-
if (ret) {
90-
ret->type = TYPE_NONE;
91-
ret->data = strdup ("None");
92-
if (!ret->data) {
93-
R_FREE (ret);
94-
}
89+
ret->type = TYPE_NONE;
90+
ret->data = strdup ("None");
91+
if (!ret->data) {
92+
R_FREE (ret);
9593
}
9694
return ret;
9795
}
9896

9997
static pyc_object *get_false_object(void) {
10098
pyc_object *ret = R_NEW0 (pyc_object);
101-
if (!ret) {
102-
return NULL;
103-
}
10499
ret->type = TYPE_FALSE;
105100
ret->data = strdup ("False");
106101
if (!ret->data) {
@@ -111,9 +106,6 @@ static pyc_object *get_false_object(void) {
111106

112107
static pyc_object *get_true_object(void) {
113108
pyc_object *ret = R_NEW0 (pyc_object);
114-
if (!ret) {
115-
return NULL;
116-
}
117109
ret->type = TYPE_TRUE;
118110
ret->data = strdup ("True");
119111
if (!ret->data) {
@@ -130,9 +122,6 @@ static pyc_object *get_int_object(RBuffer *buffer) {
130122
return NULL;
131123
}
132124
pyc_object *ret = R_NEW0 (pyc_object);
133-
if (!ret) {
134-
return NULL;
135-
}
136125
ret->type = TYPE_INT;
137126
ret->data = r_str_newf ("%d", i);
138127
if (!ret->data) {
@@ -149,12 +138,10 @@ static pyc_object *get_int64_object(RBuffer *buffer) {
149138
return NULL;
150139
}
151140
pyc_object *ret = R_NEW0 (pyc_object);
152-
if (ret) {
153-
ret->type = TYPE_INT64;
154-
ret->data = r_str_newf ("%"PFMT64d, (st64)i);
155-
if (!ret->data) {
156-
R_FREE (ret);
157-
}
141+
ret->type = TYPE_INT64;
142+
ret->data = r_str_newf ("%"PFMT64d, (st64)i);
143+
if (!ret->data) {
144+
R_FREE (ret);
158145
}
159146
return ret;
160147
}
@@ -175,9 +162,6 @@ static pyc_object *get_long_object(RBuffer *buffer) {
175162
return NULL;
176163
}
177164
pyc_object *ret = R_NEW0 (pyc_object);
178-
if (!ret) {
179-
return NULL;
180-
}
181165
ret->type = TYPE_LONG;
182166
if (ndigits < 0) {
183167
ndigits = -ndigits;
@@ -258,18 +242,14 @@ static pyc_object *get_stringref_object(RBuffer *buffer, PycUnmarshalCtx *ctx) {
258242
}
259243

260244
static pyc_object *get_float_object(RBuffer *buffer) {
261-
pyc_object *ret = NULL;
262245
bool error = false;
263246
ut32 size = 0;
264247

265248
ut8 n = get_ut8 (buffer, &error);
266249
if (error) {
267250
return NULL;
268251
}
269-
ret = R_NEW0 (pyc_object);
270-
if (!ret) {
271-
return NULL;
272-
}
252+
pyc_object *ret = R_NEW0 (pyc_object);
273253
ut8 *s = malloc (n + 1);
274254
if (!s) {
275255
free (ret);
@@ -289,15 +269,14 @@ static pyc_object *get_float_object(RBuffer *buffer) {
289269
}
290270

291271
static pyc_object *get_binary_float_object(RBuffer *buffer) {
292-
pyc_object *ret = NULL;
293272
bool error = false;
294273
double f;
295274

296275
f = get_float64 (buffer, &error);
297276
if (error) {
298277
return NULL;
299278
}
300-
ret = R_NEW0 (pyc_object);
279+
pyc_object *ret = R_NEW0 (pyc_object);
301280
if (!ret) {
302281
return NULL;
303282
}
@@ -385,9 +364,6 @@ static pyc_object *get_binary_complex_object(RBuffer *buffer) {
385364
return NULL;
386365
}
387366
ret = R_NEW0 (pyc_object);
388-
if (!ret) {
389-
return NULL;
390-
}
391367
ret->type = TYPE_BINARY_COMPLEX;
392368
ret->data = r_str_newf ("%.15g+%.15gj", a, b);
393369
if (!ret->data) {
@@ -411,9 +387,6 @@ static pyc_object *get_string_object(RBuffer *buffer) {
411387
return NULL;
412388
}
413389
ret = R_NEW0 (pyc_object);
414-
if (!ret) {
415-
return NULL;
416-
}
417390
ret->type = TYPE_STRING;
418391
ret->data = get_bytes (buffer, n);
419392
if (!ret->data) {
@@ -813,12 +786,6 @@ static pyc_object *get_code_object(RBuffer *buffer, PycUnmarshalCtx *ctx) {
813786

814787
pyc_object *ret = R_NEW0 (pyc_object);
815788
pyc_code_object *cobj = R_NEW0 (pyc_code_object);
816-
if (!ret || !cobj) {
817-
free (ret);
818-
free (cobj);
819-
return NULL;
820-
}
821-
822789
// ret->type = TYPE_CODE_v1;
823790
// support start from v1.0
824791
ret->data = cobj;

0 commit comments

Comments
 (0)