Source
244
244
/* Initialize buffer */
245
245
HDstrcpy(buf,"foo");
246
246
247
247
/* Wrap ref-counted string around existing buffer */
248
248
rs=H5RS_wrap(buf);
249
249
CHECK_PTR(rs, "H5RS_wrap");
250
250
251
251
/* Get pointer to raw string in ref-counted string */
252
252
s=H5RS_get_str(rs);
253
253
CHECK_PTR(s, "H5RS_get_str");
254
-
VERIFY(s, buf, "wrapping");
254
+
CHECK_PTR_EQ(s, buf, "wrapping");
255
255
cmp=HDstrcmp(s,buf);
256
256
VERIFY(cmp, 0, "HDstrcmp");
257
257
258
258
/* Increment reference count (should duplicate string) */
259
259
ret=H5RS_incr(rs);
260
260
CHECK(ret, FAIL, "H5RS_incr");
261
261
262
262
/* Change the buffer initially wrapped */
263
263
buf[0]='F';
264
264
302
302
CHECK_PTR(s, "H5FL_BLK_MALLOC");
303
303
HDstrcpy(s, "foo");
304
304
305
305
/* Transfer ownership of dynamically allocated string to ref-counted string */
306
306
rs=H5RS_own(s);
307
307
CHECK_PTR(rs, "H5RS_own");
308
308
309
309
/* Get pointer to raw string in ref-counted string */
310
310
t=H5RS_get_str(rs);
311
311
CHECK_PTR(t, "H5RS_get_str");
312
-
VERIFY(t, s, "transferring");
312
+
CHECK_PTR_EQ(t, s, "transferring");
313
313
cmp=HDstrcmp(s,t);
314
314
VERIFY(cmp, 0, "HDstrcmp");
315
315
316
316
/* Increment reference count (should NOT duplicate string) */
317
317
ret=H5RS_incr(rs);
318
318
CHECK(ret, FAIL, "H5RS_incr");
319
319
320
320
/* Change the buffer initially wrapped */
321
321
*s='F';
322
322
323
323
/* Get pointer to raw string in ref-counted string */
324
324
t=H5RS_get_str(rs);
325
325
CHECK_PTR(t, "H5RS_get_str");
326
-
VERIFY(t, s, "transferring");
326
+
CHECK_PTR_EQ(t, s, "transferring");
327
327
cmp=HDstrcmp(t,s);
328
328
VERIFY(cmp, 0, "HDstrcmp");
329
329
330
330
/* Decrement reference count for string */
331
331
ret=H5RS_decr(rs);
332
332
CHECK(ret, FAIL, "H5RS_decr");
333
333
ret=H5RS_decr(rs);
334
334
CHECK(ret, FAIL, "H5RS_decr");
335
335
336
336
} /* end test_refstr_own() */