diff options
author | Nils Wallménius <nils@rockbox.org> | 2009-08-20 16:47:44 +0000 |
---|---|---|
committer | Nils Wallménius <nils@rockbox.org> | 2009-08-20 16:47:44 +0000 |
commit | 3200d04d75c5e7556ed8880b155533e881a4d1e1 (patch) | |
tree | 188e2c9525b25cb8922a14766e51ab02bad3f831 /apps/plugins/chessbox/chessbox_pgn.c | |
parent | 0a1728444882cdbc6a0c815bd88464de25ad94e9 (diff) | |
download | rockbox-3200d04d75c5e7556ed8880b155533e881a4d1e1.tar.gz rockbox-3200d04d75c5e7556ed8880b155533e881a4d1e1.zip |
Make the formatter functions used by the settings return a pointer to avoid usless copying of lang strings, this brought with it a long chain of const correctness and a few random cleanups
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22440 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/chessbox/chessbox_pgn.c')
-rw-r--r-- | apps/plugins/chessbox/chessbox_pgn.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/apps/plugins/chessbox/chessbox_pgn.c b/apps/plugins/chessbox/chessbox_pgn.c index cd163a5e1c..512fb0ca15 100644 --- a/apps/plugins/chessbox/chessbox_pgn.c +++ b/apps/plugins/chessbox/chessbox_pgn.c | |||
@@ -528,11 +528,10 @@ void coords_to_pgn(struct pgn_ply_node* ply){ | |||
528 | } | 528 | } |
529 | } | 529 | } |
530 | 530 | ||
531 | char * get_game_text(int selected_item, void *data, | 531 | static const char* get_game_text(int selected_item, void *data, |
532 | char *buffer, size_t buffer_len){ | 532 | char *buffer, size_t buffer_len){ |
533 | int i; | 533 | int i; |
534 | struct pgn_game_node *temp_node = (struct pgn_game_node *)data; | 534 | struct pgn_game_node *temp_node = (struct pgn_game_node *)data; |
535 | char text_buffer[50]; | ||
536 | 535 | ||
537 | for (i=0;i<selected_item && temp_node != NULL;i++){ | 536 | for (i=0;i<selected_item && temp_node != NULL;i++){ |
538 | temp_node = temp_node->next_node; | 537 | temp_node = temp_node->next_node; |
@@ -540,10 +539,9 @@ char * get_game_text(int selected_item, void *data, | |||
540 | if (temp_node == NULL){ | 539 | if (temp_node == NULL){ |
541 | return NULL; | 540 | return NULL; |
542 | } | 541 | } |
543 | rb->snprintf(text_buffer, 50,"%s vs. %s (%s)", temp_node->white_player, | 542 | rb->snprintf(buffer, buffer_len,"%s vs. %s (%s)", temp_node->white_player, |
544 | temp_node->black_player, temp_node->game_date); | 543 | temp_node->black_player, temp_node->game_date); |
545 | 544 | ||
546 | rb->strlcpy(buffer, text_buffer, buffer_len); | ||
547 | return buffer; | 545 | return buffer; |
548 | } | 546 | } |
549 | 547 | ||