summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorCedric Bail <cedric.bail@samsung.com>2013-11-04 11:26:59 +0900
committerCedric Bail <cedric.bail@samsung.com>2013-11-04 11:26:59 +0900
commit687e4ae7442e9763e0587553d50a4177d2f9b6ca (patch)
tree418a8eba800de69b0d065429038d085ebc8f2538 /src/lib
parenta3eb8d2e9d42a83c633d19196d28f3c621522dc5 (diff)
eina: roll const into Eina_File API.
Note that eina_file_dup is const from the caller perspective as it will return a fresh "non const" Eina_File that it will be able to manipulate as it like.
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/eina/eina_file.h8
-rw-r--r--src/lib/eina/eina_file_common.c10
2 files changed, 10 insertions, 8 deletions
diff --git a/src/lib/eina/eina_file.h b/src/lib/eina/eina_file.h
index 8384e2a22a..fa0331619e 100644
--- a/src/lib/eina/eina_file.h
+++ b/src/lib/eina/eina_file.h
@@ -507,7 +507,7 @@ EAPI Eina_Bool eina_file_refresh(Eina_File *file);
507 * 507 *
508 * @since 1.8 508 * @since 1.8
509 */ 509 */
510EAPI Eina_File * eina_file_dup(Eina_File *file); 510EAPI Eina_File * eina_file_dup(const Eina_File *file);
511 511
512/** 512/**
513 * @brief Unref file handler. 513 * @brief Unref file handler.
@@ -528,7 +528,7 @@ EAPI void eina_file_close(Eina_File *file);
528 * 528 *
529 * @since 1.1 529 * @since 1.1
530 */ 530 */
531EAPI size_t eina_file_size_get(Eina_File *file); 531EAPI size_t eina_file_size_get(const Eina_File *file);
532 532
533/** 533/**
534 * @brief Get the last modification time of an open file. 534 * @brief Get the last modification time of an open file.
@@ -538,7 +538,7 @@ EAPI size_t eina_file_size_get(Eina_File *file);
538 * 538 *
539 * @since 1.1 539 * @since 1.1
540 */ 540 */
541EAPI time_t eina_file_mtime_get(Eina_File *file); 541EAPI time_t eina_file_mtime_get(const Eina_File *file);
542 542
543/** 543/**
544 * @brief Get the filename of an open file. 544 * @brief Get the filename of an open file.
@@ -548,7 +548,7 @@ EAPI time_t eina_file_mtime_get(Eina_File *file);
548 * 548 *
549 * @since 1.1 549 * @since 1.1
550 */ 550 */
551EAPI const char *eina_file_filename_get(Eina_File *file); 551EAPI const char *eina_file_filename_get(const Eina_File *file);
552 552
553/** 553/**
554 * @brief Get the eXtended attribute of an open file. 554 * @brief Get the eXtended attribute of an open file.
diff --git a/src/lib/eina/eina_file_common.c b/src/lib/eina/eina_file_common.c
index e5b1250e09..5a0250cc4a 100644
--- a/src/lib/eina/eina_file_common.c
+++ b/src/lib/eina/eina_file_common.c
@@ -431,8 +431,10 @@ eina_file_virtual(Eina_File *file)
431} 431}
432 432
433EAPI Eina_File * 433EAPI Eina_File *
434eina_file_dup(Eina_File *file) 434eina_file_dup(const Eina_File *f)
435{ 435{
436 Eina_File *file = (Eina_File*) f;
437
436 if (file) 438 if (file)
437 { 439 {
438 eina_lock_take(&file->lock); 440 eina_lock_take(&file->lock);
@@ -464,21 +466,21 @@ eina_file_close(Eina_File *file)
464} 466}
465 467
466EAPI size_t 468EAPI size_t
467eina_file_size_get(Eina_File *file) 469eina_file_size_get(const Eina_File *file)
468{ 470{
469 EINA_SAFETY_ON_NULL_RETURN_VAL(file, 0); 471 EINA_SAFETY_ON_NULL_RETURN_VAL(file, 0);
470 return file->length; 472 return file->length;
471} 473}
472 474
473EAPI time_t 475EAPI time_t
474eina_file_mtime_get(Eina_File *file) 476eina_file_mtime_get(const Eina_File *file)
475{ 477{
476 EINA_SAFETY_ON_NULL_RETURN_VAL(file, 0); 478 EINA_SAFETY_ON_NULL_RETURN_VAL(file, 0);
477 return file->mtime; 479 return file->mtime;
478} 480}
479 481
480EAPI const char * 482EAPI const char *
481eina_file_filename_get(Eina_File *file) 483eina_file_filename_get(const Eina_File *file)
482{ 484{
483 EINA_SAFETY_ON_NULL_RETURN_VAL(file, NULL); 485 EINA_SAFETY_ON_NULL_RETURN_VAL(file, NULL);
484 return file->filename; 486 return file->filename;