comparison libpurple/plugins/perl/common/Conversation.xs @ 24690:68a90c95b722

Tweak a few for loop conditions in the Perl bindings per Etan's suggestion. References #7687.
author John Bailey <rekkanoryo@rekkanoryo.org>
date Thu, 11 Dec 2008 06:48:25 +0000
parents 08b65145276a
children 34b02adafd9b
comparison
equal deleted inserted replaced
24688:08b65145276a 24690:68a90c95b722
334 int i, t_len; 334 int i, t_len;
335 PPCODE: 335 PPCODE:
336 t_GL = NULL; 336 t_GL = NULL;
337 t_len = av_len((AV *)SvRV(users)) + 1; 337 t_len = av_len((AV *)SvRV(users)) + 1;
338 338
339 for (i = 0; i < t_len; i++) 339 for (i = 0; i <= t_len; i++)
340 t_GL = g_list_append(t_GL, SvPVutf8_nolen(*av_fetch((AV *)SvRV(users), i, 0))); 340 t_GL = g_list_append(t_GL, SvPVutf8_nolen(*av_fetch((AV *)SvRV(users), i, 0)));
341 341
342 for (l = purple_conv_chat_set_users(chat, t_GL); l != NULL; l = l->next) { 342 for (l = purple_conv_chat_set_users(chat, t_GL); l != NULL; l = l->next) {
343 XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::ListEntry"))); 343 XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::ListEntry")));
344 } 344 }
372 int i, t_len; 372 int i, t_len;
373 PPCODE: 373 PPCODE:
374 t_GL = NULL; 374 t_GL = NULL;
375 t_len = av_len((AV *)SvRV(ignored)) + 1; 375 t_len = av_len((AV *)SvRV(ignored)) + 1;
376 376
377 for (i = 0; i < t_len; i++) 377 for (i = 0; i <= t_len; i++)
378 t_GL = g_list_append(t_GL, SvPVutf8_nolen(*av_fetch((AV *)SvRV(ignored), i, 0))); 378 t_GL = g_list_append(t_GL, SvPVutf8_nolen(*av_fetch((AV *)SvRV(ignored), i, 0)));
379 379
380 for (l = purple_conv_chat_set_ignored(chat, t_GL); l != NULL; l = l->next) { 380 for (l = purple_conv_chat_set_ignored(chat, t_GL); l != NULL; l = l->next) {
381 XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::ListEntry"))); 381 XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::ListEntry")));
382 } 382 }
429 int i, t_len; 429 int i, t_len;
430 PPCODE: 430 PPCODE:
431 t_GL_users = NULL; 431 t_GL_users = NULL;
432 t_len = av_len((AV *)SvRV(users)) + 1; 432 t_len = av_len((AV *)SvRV(users)) + 1;
433 433
434 for (i = 0; i < t_len; i++) 434 for (i = 0; i <= t_len; i++)
435 t_GL_users = g_list_append(t_GL_users, SvPVutf8_nolen(*av_fetch((AV *)SvRV(users), i, 0))); 435 t_GL_users = g_list_append(t_GL_users, SvPVutf8_nolen(*av_fetch((AV *)SvRV(users), i, 0)));
436 436
437 t_GL_flags = NULL; 437 t_GL_flags = NULL;
438 t_len = av_len((AV *)SvRV(flags)) + 1; 438 t_len = av_len((AV *)SvRV(flags)) + 1;
439 439
440 for (i = 0; i < t_len; i++) 440 for (i = 0; i <= t_len; i++)
441 t_GL_flags = g_list_append(t_GL_flags, SvPVutf8_nolen(*av_fetch((AV *)SvRV(flags), i, 0))); 441 t_GL_flags = g_list_append(t_GL_flags, SvPVutf8_nolen(*av_fetch((AV *)SvRV(flags), i, 0)));
442 442
443 t_GL_extra_msgs = NULL; 443 t_GL_extra_msgs = NULL;
444 t_len = av_len((AV *)SvRV(extra_msgs)) + 1; 444 t_len = av_len((AV *)SvRV(extra_msgs)) + 1;
445 445
446 for (i = 0; i < t_len; i++) 446 for (i = 0; i <= t_len; i++)
447 t_GL_extra_msgs = g_list_append(t_GL_extra_msgs, SvPVutf8_nolen(*av_fetch((AV *)SvRV(extra_msgs), i, 0))); 447 t_GL_extra_msgs = g_list_append(t_GL_extra_msgs, SvPVutf8_nolen(*av_fetch((AV *)SvRV(extra_msgs), i, 0)));
448 448
449 purple_conv_chat_add_users(chat, t_GL_users, t_GL_extra_msgs, t_GL_flags, new_arrivals); 449 purple_conv_chat_add_users(chat, t_GL_users, t_GL_extra_msgs, t_GL_flags, new_arrivals);
450 450
451 g_list_free(t_GL_users); 451 g_list_free(t_GL_users);