Commit 5571d66a authored by 马伊齐's avatar 马伊齐

自动格式化

parent 41a4b49e
......@@ -16,14 +16,11 @@
#include <sys/shm.h>
#define SHM_KEY 1234
int msgid = -1; // 全局变量,用于存储消息队列ID
int shmid;
messageQueue *queue;
// 全局数组来保存socket信息
socket_info_t sockets[MAX_CLIENTS + 1] = {0};
......@@ -286,7 +283,8 @@ int msg_local_ssignal_init(void)
{
// 获取已存在的共享内存
if ((shmid = shmget(SHM_KEY, sizeof(int), IPC_CREAT | 0666)) < 0) {
if ((shmid = shmget(SHM_KEY, sizeof(int), IPC_CREAT | 0666)) < 0)
{
perror("shmget");
return -1;
}
......@@ -304,7 +302,8 @@ int msg_local_rsignal_init(void)
{
shmid = shmget(SHM_KEY, sizeof(int), 0666);
// 获取已存在的共享内存
if ((shmid = shmget(SHM_KEY, sizeof(int), 0666)) < 0) {
if ((shmid = shmget(SHM_KEY, sizeof(int), 0666)) < 0)
{
perror("shmget");
return -1;
}
......@@ -316,7 +315,8 @@ int msg_local_rsignal_init(void)
}
}
int msg_local_send_pulse(uint16_t type, uint32_t code) {
int msg_local_send_pulse(uint16_t type, uint32_t code)
{
if (queue->rear == queue->front)
{
......@@ -340,7 +340,8 @@ int msg_local_send_pulse(uint16_t type, uint32_t code) {
}
}
int msg_local_recv_pulse(uint16_t *type, uint32_t *code) {
int msg_local_recv_pulse(uint16_t *type, uint32_t *code)
{
if (queue->rear == -1)
{
......@@ -361,7 +362,6 @@ int msg_local_recv_pulse(uint16_t *type, uint32_t *code) {
queue->rear = (queue->rear + 1) % MAX_QSIZE;
return 0;
}
}
int msg_recv(int channel, msg_data_t *msg)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment