From bf51ce812c5ee274174262ca80bc26e3feacee7a Mon Sep 17 00:00:00 2001 From: Jonathan Schleifer Date: Sat, 17 Aug 2024 00:33:22 +0000 Subject: [PATCH 1/4] Include includedir in .oc file FossilOrigin-Name: 7c54d67cf30ec374b8f855873ce30d488dd86160bc366ff2c44f3dacf18e00ca --- ObjPgSQL.oc.in | 2 +- meson.build | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/ObjPgSQL.oc.in b/ObjPgSQL.oc.in index 40bb5e7..b5c760d 100644 --- a/ObjPgSQL.oc.in +++ b/ObjPgSQL.oc.in @@ -1,5 +1,5 @@ package_format 1 -CPPFLAGS="$CPPFLAGS @LIBPQ_CPPFLAGS@" +CPPFLAGS="$CPPFLAGS -I@includedir@ @LIBPQ_CPPFLAGS@" LIBS="-L@libdir@ -lobjpgsql @LIBPQ_LIBS@ $LIBS" FRAMEWORK_LIBS="-L@libdir@ -lobjpgsql @LIBPQ_LIBS@ $FRAMEWORK_LIBS" STATIC_LIBS="@libdir@/libobjpgsql.a @LIBPQ_LIBS@ $STATIC_LIBS" diff --git a/meson.build b/meson.build index ee2c9bd..e3c3ee1 100644 --- a/meson.build +++ b/meson.build @@ -31,6 +31,7 @@ configure_file( input: 'ObjPgSQL.oc.in', output: 'ObjPgSQL.oc', configuration: { + 'includedir': get_option('prefix') / get_option('includedir'), 'libdir': get_option('prefix') / get_option('libdir'), 'LIBPQ_CPPFLAGS': libpq_cflags, 'LIBPQ_LIBS': libpq_libs, From 68fff750837a7f997e55ad588916931da83bc601 Mon Sep 17 00:00:00 2001 From: Jonathan Schleifer Date: Sat, 19 Apr 2025 13:34:33 +0000 Subject: [PATCH 2/4] Use ARC functions for RR FossilOrigin-Name: a19b24ae129c1144fed2ba35d5a57ff2298b58ebb3c8f5071613e9efe67e4f63 --- src/PGSQLConnection.m | 4 +- src/PGSQLResult.m | 3 +- src/PGSQLResultRow.m | 43 ++++++++++++------- src/exceptions/PGSQLException.m | 11 ++--- .../PGSQLExecuteCommandFailedException.m | 9 ++-- 5 files changed, 42 insertions(+), 28 deletions(-) diff --git a/src/PGSQLConnection.m b/src/PGSQLConnection.m index 4d6321f..339426c 100644 --- a/src/PGSQLConnection.m +++ b/src/PGSQLConnection.m @@ -34,7 +34,7 @@ @try { _parameters = [[OFDictionary alloc] init]; } @catch (id e) { - [self release]; + objc_release(self); @throw e; } @@ -43,7 +43,7 @@ - (void)dealloc { - [_parameters release]; + objc_release(_parameters); [self close]; diff --git a/src/PGSQLResult.m b/src/PGSQLResult.m index 9798f21..f79770c 100644 --- a/src/PGSQLResult.m +++ b/src/PGSQLResult.m @@ -26,7 +26,8 @@ + (instancetype)pg_resultWithResult: (PGresult *)result { - return [[[self alloc] pg_initWithResult: result] autorelease]; + return objc_autoreleaseReturnValue( + [[self alloc] pg_initWithResult: result]); } - (instancetype)pg_initWithResult: (PGresult *)result diff --git a/src/PGSQLResultRow.m b/src/PGSQLResultRow.m index edc1e4d..fa00887 100644 --- a/src/PGSQLResultRow.m +++ b/src/PGSQLResultRow.m @@ -65,23 +65,29 @@ convertType(PGresult *res, int column, OFString *string) @implementation PGSQLResultRow + (instancetype)pg_rowWithResult: (PGSQLResult *)result row: (int)row { - return [[[self alloc] pg_initWithResult: result row: row] autorelease]; + return objc_autoreleaseReturnValue( + [[self alloc] pg_initWithResult: result row: row]); } - (instancetype)pg_initWithResult: (PGSQLResult *)result row: (int)row { self = [super init]; - _result = [result retain]; - _res = result.pg_result; - _row = row; + @try { + _result = objc_retain(result); + _res = result.pg_result; + _row = row; + } @catch (id e) { + objc_release(self); + @throw e; + } return self; } - (void)dealloc { - [_result release]; + objc_release(_result); [super dealloc]; } @@ -115,16 +121,16 @@ convertType(PGresult *res, int column, OFString *string) - (OFEnumerator *)keyEnumerator { - return [[[PGSQLResultRowKeyEnumerator alloc] - initWithResult: _result - row: _row] autorelease]; + return objc_autoreleaseReturnValue( + [[PGSQLResultRowKeyEnumerator alloc] initWithResult: _result + row: _row]); } - (OFEnumerator *)objectEnumerator { - return [[[PGSQLResultRowObjectEnumerator alloc] - initWithResult: _result - row: _row] autorelease]; + return objc_autoreleaseReturnValue( + [[PGSQLResultRowObjectEnumerator alloc] initWithResult: _result + row: _row]); } - (int)countByEnumeratingWithState: (OFFastEnumerationState *)state @@ -165,17 +171,22 @@ convertType(PGresult *res, int column, OFString *string) { self = [super init]; - _result = [result retain]; - _res = result.pg_result; - _row = row; - _count = PQnfields(_res); + @try { + _result = objc_retain(result); + _res = result.pg_result; + _row = row; + _count = PQnfields(_res); + } @catch (id e) { + objc_release(self); + @throw e; + } return self; } - (void)dealloc { - [_result release]; + objc_release(_result); [super dealloc]; } diff --git a/src/exceptions/PGSQLException.m b/src/exceptions/PGSQLException.m index 1979851..2dafd23 100644 --- a/src/exceptions/PGSQLException.m +++ b/src/exceptions/PGSQLException.m @@ -29,7 +29,8 @@ + (instancetype)exceptionWithConnection: (PGSQLConnection *)connection { - return [[[self alloc] initWithConnection: connection] autorelease]; + return objc_autoreleaseReturnValue( + [[self alloc] initWithConnection: connection]); } - (instancetype)init @@ -42,12 +43,12 @@ self = [super init]; @try { - _connection = [connection retain]; + _connection = objc_retain(connection); _errorMessage = [[OFString alloc] initWithCString: PQerrorMessage([_connection pg_connection]) encoding: [OFLocale encoding]]; } @catch (id e) { - [self release]; + objc_release(self); @throw e; } @@ -56,8 +57,8 @@ - (void)dealloc { - [_connection release]; - [_errorMessage release]; + objc_release(_connection); + objc_release(_errorMessage); [super dealloc]; } diff --git a/src/exceptions/PGSQLExecuteCommandFailedException.m b/src/exceptions/PGSQLExecuteCommandFailedException.m index 833b6c3..ad4799d 100644 --- a/src/exceptions/PGSQLExecuteCommandFailedException.m +++ b/src/exceptions/PGSQLExecuteCommandFailedException.m @@ -29,8 +29,9 @@ + (instancetype)exceptionWithConnection: (PGSQLConnection *)connection command: (OFConstantString *)command { - return [[[self alloc] initWithConnection: connection - command: command] autorelease]; + return objc_autoreleaseReturnValue( + [[self alloc] initWithConnection: connection + command: command]); } - (instancetype)initWithConnection: (PGSQLConnection *)connection @@ -46,7 +47,7 @@ @try { _command = [command copy]; } @catch (id e) { - [self release]; + objc_release(self); @throw e; } @@ -55,7 +56,7 @@ - (void)dealloc { - [_command release]; + objc_release(_command); [super dealloc]; } From b75455125adb86c5307c164bdc8af6cfa48074b5 Mon Sep 17 00:00:00 2001 From: Jonathan Schleifer Date: Mon, 23 Jun 2025 23:20:21 +0200 Subject: [PATCH 3/4] Set version to 1.0.1 --- meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meson.build b/meson.build index e3c3ee1..4bf27e2 100644 --- a/meson.build +++ b/meson.build @@ -1,5 +1,5 @@ project('ObjPgSQL', 'objc', - version: '1.0', + version: '1.0.1', meson_version: '>= 1.5.0', default_options: { 'warning_level': '3', From d8f53de646da8fd024bfeb052c829be5d2723745 Mon Sep 17 00:00:00 2001 From: Jonathan Schleifer Date: Tue, 24 Jun 2025 18:35:30 +0200 Subject: [PATCH 4/4] Update copyright & URL --- src/ObjPgSQL.h | 4 ++-- src/PGSQLConnection+Private.h | 4 ++-- src/PGSQLConnection.h | 4 ++-- src/PGSQLConnection.m | 4 ++-- src/PGSQLResult+Private.h | 4 ++-- src/PGSQLResult.h | 4 ++-- src/PGSQLResult.m | 4 ++-- src/PGSQLResultRow+Private.h | 4 ++-- src/PGSQLResultRow.h | 4 ++-- src/PGSQLResultRow.m | 4 ++-- src/exceptions/PGSQLConnectionFailedException.h | 4 ++-- src/exceptions/PGSQLConnectionFailedException.m | 4 ++-- src/exceptions/PGSQLException.h | 4 ++-- src/exceptions/PGSQLException.m | 4 ++-- src/exceptions/PGSQLExecuteCommandFailedException.h | 4 ++-- src/exceptions/PGSQLExecuteCommandFailedException.m | 4 ++-- tests/Tests.m | 4 ++-- 17 files changed, 34 insertions(+), 34 deletions(-) diff --git a/src/ObjPgSQL.h b/src/ObjPgSQL.h index 15cc62e..902a6c0 100644 --- a/src/ObjPgSQL.h +++ b/src/ObjPgSQL.h @@ -1,7 +1,7 @@ /* - * Copyright (c) 2012 - 2019, 2021, 2024 Jonathan Schleifer + * Copyright (c) 2012 - 2019, 2021, 2024, 2025 Jonathan Schleifer * - * https://fl.nil.im/objpgsql + * https://git.nil.im/ObjFW/ObjPgSQL * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above diff --git a/src/PGSQLConnection+Private.h b/src/PGSQLConnection+Private.h index 9138702..c8322a4 100644 --- a/src/PGSQLConnection+Private.h +++ b/src/PGSQLConnection+Private.h @@ -1,7 +1,7 @@ /* - * Copyright (c) 2012 - 2019, 2021, 2024 Jonathan Schleifer + * Copyright (c) 2012 - 2019, 2021, 2024, 2025 Jonathan Schleifer * - * https://fl.nil.im/objpgsql + * https://git.nil.im/ObjFW/ObjPgSQL * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above diff --git a/src/PGSQLConnection.h b/src/PGSQLConnection.h index d2add12..0da715b 100644 --- a/src/PGSQLConnection.h +++ b/src/PGSQLConnection.h @@ -1,7 +1,7 @@ /* - * Copyright (c) 2012 - 2019, 2021, 2024 Jonathan Schleifer + * Copyright (c) 2012 - 2019, 2021, 2024, 2025 Jonathan Schleifer * - * https://fl.nil.im/objpgsql + * https://git.nil.im/ObjFW/ObjPgSQL * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above diff --git a/src/PGSQLConnection.m b/src/PGSQLConnection.m index 339426c..6703229 100644 --- a/src/PGSQLConnection.m +++ b/src/PGSQLConnection.m @@ -1,7 +1,7 @@ /* - * Copyright (c) 2012 - 2019, 2021, 2024 Jonathan Schleifer + * Copyright (c) 2012 - 2019, 2021, 2024, 2025 Jonathan Schleifer * - * https://fl.nil.im/objpgsql + * https://git.nil.im/ObjFW/ObjPgSQL * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above diff --git a/src/PGSQLResult+Private.h b/src/PGSQLResult+Private.h index ab31ad0..26c034a 100644 --- a/src/PGSQLResult+Private.h +++ b/src/PGSQLResult+Private.h @@ -1,7 +1,7 @@ /* - * Copyright (c) 2012 - 2019, 2021, 2024 Jonathan Schleifer + * Copyright (c) 2012 - 2019, 2021, 2024, 2025 Jonathan Schleifer * - * https://fl.nil.im/objpgsql + * https://git.nil.im/ObjFW/ObjPgSQL * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above diff --git a/src/PGSQLResult.h b/src/PGSQLResult.h index 82e3137..37daedc 100644 --- a/src/PGSQLResult.h +++ b/src/PGSQLResult.h @@ -1,7 +1,7 @@ /* - * Copyright (c) 2012 - 2019, 2021, 2024 Jonathan Schleifer + * Copyright (c) 2012 - 2019, 2021, 2024, 2025 Jonathan Schleifer * - * https://fl.nil.im/objpgsql + * https://git.nil.im/ObjFW/ObjPgSQL * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above diff --git a/src/PGSQLResult.m b/src/PGSQLResult.m index f79770c..a477c3e 100644 --- a/src/PGSQLResult.m +++ b/src/PGSQLResult.m @@ -1,7 +1,7 @@ /* - * Copyright (c) 2012 - 2019, 2021, 2024 Jonathan Schleifer + * Copyright (c) 2012 - 2019, 2021, 2024, 2025 Jonathan Schleifer * - * https://fl.nil.im/objpgsql + * https://git.nil.im/ObjFW/ObjPgSQL * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above diff --git a/src/PGSQLResultRow+Private.h b/src/PGSQLResultRow+Private.h index 15b9509..263cc88 100644 --- a/src/PGSQLResultRow+Private.h +++ b/src/PGSQLResultRow+Private.h @@ -1,7 +1,7 @@ /* - * Copyright (c) 2012 - 2019, 2021, 2024 Jonathan Schleifer + * Copyright (c) 2012 - 2019, 2021, 2024, 2025 Jonathan Schleifer * - * https://fl.nil.im/objpgsql + * https://git.nil.im/ObjFW/ObjPgSQL * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above diff --git a/src/PGSQLResultRow.h b/src/PGSQLResultRow.h index 06cd335..3291bd8 100644 --- a/src/PGSQLResultRow.h +++ b/src/PGSQLResultRow.h @@ -1,7 +1,7 @@ /* - * Copyright (c) 2012 - 2019, 2021, 2024 Jonathan Schleifer + * Copyright (c) 2012 - 2019, 2021, 2024, 2025 Jonathan Schleifer * - * https://fl.nil.im/objpgsql + * https://git.nil.im/ObjFW/ObjPgSQL * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above diff --git a/src/PGSQLResultRow.m b/src/PGSQLResultRow.m index fa00887..c5cc316 100644 --- a/src/PGSQLResultRow.m +++ b/src/PGSQLResultRow.m @@ -1,7 +1,7 @@ /* - * Copyright (c) 2012 - 2019, 2021, 2024 Jonathan Schleifer + * Copyright (c) 2012 - 2019, 2021, 2024, 2025 Jonathan Schleifer * - * https://fl.nil.im/objpgsql + * https://git.nil.im/ObjFW/ObjPgSQL * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above diff --git a/src/exceptions/PGSQLConnectionFailedException.h b/src/exceptions/PGSQLConnectionFailedException.h index be620ed..3d28302 100644 --- a/src/exceptions/PGSQLConnectionFailedException.h +++ b/src/exceptions/PGSQLConnectionFailedException.h @@ -1,7 +1,7 @@ /* - * Copyright (c) 2012 - 2019, 2021, 2024 Jonathan Schleifer + * Copyright (c) 2012 - 2019, 2021, 2024, 2025 Jonathan Schleifer * - * https://fl.nil.im/objpgsql + * https://git.nil.im/ObjFW/ObjPgSQL * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above diff --git a/src/exceptions/PGSQLConnectionFailedException.m b/src/exceptions/PGSQLConnectionFailedException.m index 1a21b17..a5e6bb7 100644 --- a/src/exceptions/PGSQLConnectionFailedException.m +++ b/src/exceptions/PGSQLConnectionFailedException.m @@ -1,7 +1,7 @@ /* - * Copyright (c) 2012 - 2019, 2021, 2024 Jonathan Schleifer + * Copyright (c) 2012 - 2019, 2021, 2024, 2025 Jonathan Schleifer * - * https://fl.nil.im/objpgsql + * https://git.nil.im/ObjFW/ObjPgSQL * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above diff --git a/src/exceptions/PGSQLException.h b/src/exceptions/PGSQLException.h index 7fb9485..8c373b1 100644 --- a/src/exceptions/PGSQLException.h +++ b/src/exceptions/PGSQLException.h @@ -1,7 +1,7 @@ /* - * Copyright (c) 2012 - 2019, 2021, 2024 Jonathan Schleifer + * Copyright (c) 2012 - 2019, 2021, 2024, 2025 Jonathan Schleifer * - * https://fl.nil.im/objpgsql + * https://git.nil.im/ObjFW/ObjPgSQL * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above diff --git a/src/exceptions/PGSQLException.m b/src/exceptions/PGSQLException.m index 2dafd23..907d285 100644 --- a/src/exceptions/PGSQLException.m +++ b/src/exceptions/PGSQLException.m @@ -1,7 +1,7 @@ /* - * Copyright (c) 2012 - 2019, 2021, 2024 Jonathan Schleifer + * Copyright (c) 2012 - 2019, 2021, 2024, 2025 Jonathan Schleifer * - * https://fl.nil.im/objpgsql + * https://git.nil.im/ObjFW/ObjPgSQL * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above diff --git a/src/exceptions/PGSQLExecuteCommandFailedException.h b/src/exceptions/PGSQLExecuteCommandFailedException.h index 6989735..4039d2f 100644 --- a/src/exceptions/PGSQLExecuteCommandFailedException.h +++ b/src/exceptions/PGSQLExecuteCommandFailedException.h @@ -1,7 +1,7 @@ /* - * Copyright (c) 2012 - 2019, 2021, 2024 Jonathan Schleifer + * Copyright (c) 2012 - 2019, 2021, 2024, 2025 Jonathan Schleifer * - * https://fl.nil.im/objpgsql + * https://git.nil.im/ObjFW/ObjPgSQL * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above diff --git a/src/exceptions/PGSQLExecuteCommandFailedException.m b/src/exceptions/PGSQLExecuteCommandFailedException.m index ad4799d..04fbade 100644 --- a/src/exceptions/PGSQLExecuteCommandFailedException.m +++ b/src/exceptions/PGSQLExecuteCommandFailedException.m @@ -1,7 +1,7 @@ /* - * Copyright (c) 2012 - 2019, 2021, 2024 Jonathan Schleifer + * Copyright (c) 2012 - 2019, 2021, 2024, 2025 Jonathan Schleifer * - * https://fl.nil.im/objpgsql + * https://git.nil.im/ObjFW/ObjPgSQL * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above diff --git a/tests/Tests.m b/tests/Tests.m index 8b9fc89..428ddb8 100644 --- a/tests/Tests.m +++ b/tests/Tests.m @@ -1,7 +1,7 @@ /* - * Copyright (c) 2012 - 2019, 2021, 2024 Jonathan Schleifer + * Copyright (c) 2012 - 2019, 2021, 2024, 2025 Jonathan Schleifer * - * https://fl.nil.im/objpgsql + * https://git.nil.im/ObjFW/ObjPgSQL * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above