summaryrefslogtreecommitdiff
path: root/libparted/fs
diff options
context:
space:
mode:
authorShin'ichiro Kawasaki <kawasaki@juno.dti.ne.jp>2019-08-14 10:59:20 +0900
committerBrian C. Lane <bcl@redhat.com>2020-11-20 14:00:58 -0800
commit34347779d3235186a68a040d3f3166ff45e65dac (patch)
tree9b2112b40268a899eab5d09e18ec046290914058 /libparted/fs
parent20c136159b37f11822b591941c077bb2be6ede05 (diff)
downloadparted-34347779d3235186a68a040d3f3166ff45e65dac.tar.gz
libparted: Fix warnings from GCC 8 -Wsuggest-attribute=const
As GCC 8 suggests, add 'const' attribute to six functions. After adding const attributes, GCC suggested two more functions to add const attributes. Add const attributes to those functions also. In total, add const attributes to 8 functions. I read code of the functions and confirmed they are const: they examine only their arguments and have no effect other than return value. Signed-off-by: Shin'ichiro Kawasaki <kawasaki@juno.dti.ne.jp> Signed-off-by: Brian C. Lane <bcl@redhat.com>
Diffstat (limited to 'libparted/fs')
-rw-r--r--libparted/fs/r/fat/calc.c14
-rw-r--r--libparted/fs/r/fat/table.c2
2 files changed, 8 insertions, 8 deletions
diff --git a/libparted/fs/r/fat/calc.c b/libparted/fs/r/fat/calc.c
index 60c6bac..18e0455 100644
--- a/libparted/fs/r/fat/calc.c
+++ b/libparted/fs/r/fat/calc.c
@@ -23,7 +23,7 @@
#ifndef DISCOVER_ONLY
/* returns the minimum size of clusters for a given file system type */
-PedSector
+PedSector _GL_ATTRIBUTE_CONST
fat_min_cluster_size (FatType fat_type) {
switch (fat_type) {
case FAT_TYPE_FAT12: return 1;
@@ -33,7 +33,7 @@ fat_min_cluster_size (FatType fat_type) {
return 0;
}
-static PedSector
+static PedSector _GL_ATTRIBUTE_CONST
_smallest_power2_over (PedSector ceiling)
{
PedSector result = 1;
@@ -45,7 +45,7 @@ _smallest_power2_over (PedSector ceiling)
}
/* returns the minimum size of clusters for a given file system type */
-PedSector
+PedSector _GL_ATTRIBUTE_CONST
fat_recommend_min_cluster_size (FatType fat_type, PedSector size) {
switch (fat_type) {
case FAT_TYPE_FAT12: return 1;
@@ -59,7 +59,7 @@ fat_recommend_min_cluster_size (FatType fat_type, PedSector size) {
}
/* returns the maxmimum size of clusters for a given file system type */
-PedSector
+PedSector _GL_ATTRIBUTE_CONST
fat_max_cluster_size (FatType fat_type) {
switch (fat_type) {
case FAT_TYPE_FAT12: return 1; /* dunno... who cares? */
@@ -70,7 +70,7 @@ fat_max_cluster_size (FatType fat_type) {
}
/* returns the minimum number of clusters for a given file system type */
-FatCluster
+FatCluster _GL_ATTRIBUTE_CONST
fat_min_cluster_count (FatType fat_type) {
switch (fat_type) {
case FAT_TYPE_FAT12:
@@ -83,7 +83,7 @@ fat_min_cluster_count (FatType fat_type) {
}
/* returns the maximum number of clusters for a given file system type */
-FatCluster
+FatCluster _GL_ATTRIBUTE_CONST
fat_max_cluster_count (FatType fat_type) {
switch (fat_type) {
case FAT_TYPE_FAT12: return 0xff0;
@@ -94,7 +94,7 @@ fat_max_cluster_count (FatType fat_type) {
}
/* what is this supposed to be? What drugs are M$ on? (Can I have some? :-) */
-PedSector
+PedSector _GL_ATTRIBUTE_CONST
fat_min_reserved_sector_count (FatType fat_type)
{
return (fat_type == FAT_TYPE_FAT32) ? 32 : 1;
diff --git a/libparted/fs/r/fat/table.c b/libparted/fs/r/fat/table.c
index 98b0499..394a519 100644
--- a/libparted/fs/r/fat/table.c
+++ b/libparted/fs/r/fat/table.c
@@ -462,7 +462,7 @@ fat_table_set_avail (FatTable* ft, FatCluster cluster)
#endif /* !DISCOVER_ONLY */
-int
+int _GL_ATTRIBUTE_CONST
fat_table_entry_size (FatType fat_type)
{
switch (fat_type) {