Compare commits

..

3 Commits

Author SHA1 Message Date
YuQing 0ebccb5bf0 INSTALL changed for V1.0.85 2026-06-23 15:59:56 +08:00
YuQing cf40f8e42e add function fc_version 2026-06-23 15:39:50 +08:00
YuQing e5fa72b971 upgrade version to 1.0.85 2026-06-23 11:29:07 +08:00
7 changed files with 83 additions and 23 deletions

View File

@ -1,7 +1,8 @@
Version 1.85 2026-06-22 Version 1.85 2026-06-23
* add functions fc_safe_srand and fc_safe_rand for more security under Linux * add functions fc_safe_srand and fc_safe_rand for more security under Linux
* add function seconds_to_human_str * add function seconds_to_human_str
* add function fc_version by new files fc_version.h and fc_version.c
Version 1.84 2026-01-16 Version 1.84 2026-01-16
* fast_task_queue.h: add function free_queue_task_arg_offset * fast_task_queue.h: add function free_queue_task_arg_offset

View File

@ -21,5 +21,5 @@ Debian, Ubuntu etc.:
# the command lines as: # the command lines as:
git clone https://github.com/happyfish100/libfastcommon.git git clone https://github.com/happyfish100/libfastcommon.git
cd libfastcommon; git checkout V1.0.84 cd libfastcommon; git checkout V1.0.85
./make.sh clean && ./make.sh && sudo ./make.sh install ./make.sh clean && ./make.sh && sudo ./make.sh install

View File

@ -3,7 +3,7 @@
%define CommitVersion %(echo $COMMIT_VERSION) %define CommitVersion %(echo $COMMIT_VERSION)
Name: libfastcommon Name: libfastcommon
Version: 1.0.84 Version: 1.0.85
Release: 1%{?dist} Release: 1%{?dist}
Summary: c common functions library extracted from my open source projects FastDFS Summary: c common functions library extracted from my open source projects FastDFS
License: LGPL License: LGPL

View File

@ -23,7 +23,7 @@
#include <stdio.h> #include <stdio.h>
#include <errno.h> #include <errno.h>
#include <time.h> #include <time.h>
#include "common_define.h" #include "fc_version.h"
#include "local_ip_func.h" #include "local_ip_func.h"
#include "logger.h" #include "logger.h"
#include "hash.h" #include "hash.h"
@ -33,10 +33,6 @@
#include "system_info.h" #include "system_info.h"
#include "fastcommon.h" #include "fastcommon.h"
#define MAJOR_VERSION 1
#define MINOR_VERSION 0
#define PATCH_VERSION 8
#define IDG_FLAGS_EXTRA_DATA_BY_MOD 1 #define IDG_FLAGS_EXTRA_DATA_BY_MOD 1
#define PHP_IDG_RESOURCE_NAME "fastcommon_idg" #define PHP_IDG_RESOURCE_NAME "fastcommon_idg"
@ -311,13 +307,13 @@ PHP_RSHUTDOWN_FUNCTION(fastcommon)
PHP_MINFO_FUNCTION(fastcommon) PHP_MINFO_FUNCTION(fastcommon)
{ {
char mc_info[64]; char mc_info[64];
sprintf(mc_info, "fastcommon v%d.%02d support", sprintf(mc_info, "fastcommon v%d.%d.%d supported",
MAJOR_VERSION, MINOR_VERSION); FC_MAJOR_VERSION, FC_MINOR_VERSION, FC_PATCH_VERSION);
php_info_print_table_start(); php_info_print_table_start();
php_info_print_table_header(2, mc_info, "enabled"); php_info_print_table_header(2, mc_info, "enabled");
php_info_print_table_end(); php_info_print_table_end();
} }
/* /*
@ -326,13 +322,14 @@ return client library version
*/ */
ZEND_FUNCTION(fastcommon_version) ZEND_FUNCTION(fastcommon_version)
{ {
char szVersion[16]; Version version;
int len; char szVersion[16];
int len;
len = sprintf(szVersion, "%d.%d.%d", fc_version(&version);
MAJOR_VERSION, MINOR_VERSION, PATCH_VERSION); len = sprintf(szVersion, "%d.%d.%d", version.major,
version.minor, version.patch);
ZEND_RETURN_STRINGL(szVersion, len, 1); ZEND_RETURN_STRINGL(szVersion, len, 1);
} }
/* /*

View File

@ -17,7 +17,8 @@ FAST_SHARED_OBJS = hash.lo chain.lo shared_func.lo ini_file_reader.lo \
multi_socket_client.lo skiplist_set.lo uniq_skiplist.lo \ multi_socket_client.lo skiplist_set.lo uniq_skiplist.lo \
json_parser.lo buffered_file_writer.lo server_id_func.lo \ json_parser.lo buffered_file_writer.lo server_id_func.lo \
fc_queue.lo sorted_queue.lo fc_memory.lo shared_buffer.lo \ fc_queue.lo sorted_queue.lo fc_memory.lo shared_buffer.lo \
thread_pool.lo array_allocator.lo sorted_array.lo spinlock.lo thread_pool.lo array_allocator.lo sorted_array.lo spinlock.lo \
fc_version.lo
FAST_STATIC_OBJS = hash.o chain.o shared_func.o ini_file_reader.o \ FAST_STATIC_OBJS = hash.o chain.o shared_func.o ini_file_reader.o \
logger.o sockopt.o base64.o sched_thread.o \ logger.o sockopt.o base64.o sched_thread.o \
@ -31,7 +32,8 @@ FAST_STATIC_OBJS = hash.o chain.o shared_func.o ini_file_reader.o \
multi_socket_client.o skiplist_set.o uniq_skiplist.o \ multi_socket_client.o skiplist_set.o uniq_skiplist.o \
json_parser.o buffered_file_writer.o server_id_func.o \ json_parser.o buffered_file_writer.o server_id_func.o \
fc_queue.o sorted_queue.o fc_memory.o shared_buffer.o \ fc_queue.o sorted_queue.o fc_memory.o shared_buffer.o \
thread_pool.o array_allocator.o sorted_array.o spinlock.o thread_pool.o array_allocator.o sorted_array.o spinlock.o \
fc_version.o
HEADER_FILES = common_define.h hash.h chain.h logger.h base64.h \ HEADER_FILES = common_define.h hash.h chain.h logger.h base64.h \
shared_func.h pthread_func.h ini_file_reader.h _os_define.h \ shared_func.h pthread_func.h ini_file_reader.h _os_define.h \
@ -47,7 +49,7 @@ HEADER_FILES = common_define.h hash.h chain.h logger.h base64.h \
fc_list.h locked_list.h json_parser.h buffered_file_writer.h \ fc_list.h locked_list.h json_parser.h buffered_file_writer.h \
server_id_func.h fc_queue.h sorted_queue.h fc_memory.h \ server_id_func.h fc_queue.h sorted_queue.h fc_memory.h \
shared_buffer.h thread_pool.h fc_atomic.h array_allocator.h \ shared_buffer.h thread_pool.h fc_atomic.h array_allocator.h \
sorted_array.h spinlock.h sorted_array.h spinlock.h fc_version.h
ALL_OBJS = $(FAST_STATIC_OBJS) $(FAST_SHARED_OBJS) ALL_OBJS = $(FAST_STATIC_OBJS) $(FAST_SHARED_OBJS)

23
src/fc_version.c Normal file
View File

@ -0,0 +1,23 @@
/*
* Copyright (c) 2026 YuQing <384681@qq.com>
*
* This program is free software: you can use, redistribute, and/or modify
* it under the terms of the Lesser GNU General Public License, version 3
* or later ("LGPL"), as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the Lesser GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "fc_version.h"
void fc_version(Version *version)
{
version->major = FC_MAJOR_VERSION;
version->minor = FC_MINOR_VERSION;
version->patch = FC_PATCH_VERSION;
}

37
src/fc_version.h Normal file
View File

@ -0,0 +1,37 @@
/*
* Copyright (c) 2026 YuQing <384681@qq.com>
*
* This program is free software: you can use, redistribute, and/or modify
* it under the terms of the Lesser GNU General Public License, version 3
* or later ("LGPL"), as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the Lesser GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
//fc_version.h
#ifndef _FC_VERSION_H
#define _FC_VERSION_H
#include "common_define.h"
#define FC_MAJOR_VERSION 1
#define FC_MINOR_VERSION 0
#define FC_PATCH_VERSION 85
#ifdef __cplusplus
extern "C" {
#endif
void fc_version(Version *version);
#ifdef __cplusplus
}
#endif
#endif