Skip to content

Remove useless pointer pattern #58

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions src/http.c
Original file line number Diff line number Diff line change
Expand Up @@ -623,7 +623,7 @@ static int op_parse_url(OpusParsedURL *_dst,const char *_src){
op_parsed_url_init(&url);
ret=op_parse_url_impl(&url,_src);
if(OP_UNLIKELY(ret<0))op_parsed_url_clear(&url);
else *_dst=*&url;
else *_dst=url;
return ret;
}

Expand Down Expand Up @@ -1068,7 +1068,7 @@ static void op_http_conn_read_rate_update(OpusHTTPConn *_conn){
read_rate=_conn->read_rate;
read_delta_ms=OP_MAX(read_delta_ms,1);
read_rate+=read_delta_bytes*1000/read_delta_ms-read_rate+4>>3;
*&_conn->read_time=*&read_time;
_conn->read_time=read_time;
_conn->read_bytes=0;
_conn->read_rate=read_rate;
}
Expand Down Expand Up @@ -2087,7 +2087,7 @@ static int op_http_connect_impl(OpusHTTPStream *_stream,OpusHTTPConn *_conn,
_conn->next=_stream->lru_head;
_stream->lru_head=_conn;
op_time_get(_start_time);
*&_conn->read_time=*_start_time;
_conn->read_time=*_start_time;
_conn->read_bytes=0;
_conn->read_rate=0;
/*Try to start a connection to each protocol.
Expand Down Expand Up @@ -2201,7 +2201,7 @@ static int op_http_connect(OpusHTTPStream *_stream,OpusHTTPConn *_conn,
new_addrs=op_resolve(_stream->connect_host,_stream->connect_port);
if(OP_LIKELY(new_addrs!=NULL)){
_addrs=new_addrs;
*&_stream->resolve_time=*&resolve_time;
_stream->resolve_time=resolve_time;
}
else if(OP_LIKELY(_addrs==NULL))return OP_FALSE;
}
Expand Down Expand Up @@ -2719,7 +2719,7 @@ static int op_http_stream_open(OpusHTTPStream *_stream,const char *_url,
/*Always try to skip re-resolve for proxy connections.*/
else addrs=&_stream->addr_info;
op_parsed_url_clear(&_stream->url);
*&_stream->url=*&next_url;
_stream->url=next_url;
/*TODO: On servers/proxies that support pipelining, we might be able to
re-use this connection.*/
op_http_conn_close(_stream,_stream->conns+0,&_stream->lru_head,1);
Expand Down Expand Up @@ -3197,7 +3197,7 @@ static int op_http_stream_seek(void *_stream,opus_int64 _offset,int _whence){
/*Mark when we deactivated the active connection.*/
if(ci>=0){
op_http_conn_read_rate_update(stream->conns+ci);
*&seek_time=*&stream->conns[ci].read_time;
seek_time=stream->conns[ci].read_time;
}
else op_time_get(&seek_time);
/*If we seeked past the end of the stream, just disable the active
Expand Down Expand Up @@ -3423,7 +3423,7 @@ static void *op_url_stream_create_impl(OpusFileCallbacks *_cb,const char *_url,
_ogg_free(stream);
return NULL;
}
*_cb=*&OP_HTTP_CALLBACKS;
*_cb=OP_HTTP_CALLBACKS;
return stream;
}
#else
Expand Down Expand Up @@ -3516,7 +3516,7 @@ void *op_url_stream_vcreate(OpusFileCallbacks *_cb,
OpusServerInfo *pinfo;
void *ret;
ret=op_url_stream_vcreate_impl(_cb,_url,&info,&pinfo,_ap);
if(pinfo!=NULL)*pinfo=*&info;
if(pinfo!=NULL)*pinfo=info;
return ret;
}

Expand Down Expand Up @@ -3549,7 +3549,7 @@ OggOpusFile *op_vopen_url(const char *_url,int *_error,va_list _ap){
if(pinfo!=NULL)opus_server_info_clear(&info);
(*cb.close)(source);
}
else if(pinfo!=NULL)*pinfo=*&info;
else if(pinfo!=NULL)*pinfo=info;
return of;
}

Expand Down Expand Up @@ -3579,7 +3579,7 @@ OggOpusFile *op_vtest_url(const char *_url,int *_error,va_list _ap){
if(pinfo!=NULL)opus_server_info_clear(&info);
(*cb.close)(source);
}
else if(pinfo!=NULL)*pinfo=*&info;
else if(pinfo!=NULL)*pinfo=info;
return of;
}

Expand Down
16 changes: 8 additions & 8 deletions src/opusfile.c
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ static int op_get_prev_page_serial(OggOpusFile *_of,OpusSeekRecord *_sr,
/*If this page is from the stream we're looking for, remember it.*/
if(serialno==_serialno){
preferred_found=1;
*&preferred_sr=*_sr;
preferred_sr=*_sr;
}
if(!op_lookup_serialno(serialno,_serialnos,_nserialnos)){
/*We fell off the end of the link, which means we seeked back too far
Expand All @@ -381,7 +381,7 @@ static int op_get_prev_page_serial(OggOpusFile *_of,OpusSeekRecord *_sr,
end=OP_MIN(begin+OP_PAGE_SIZE_MAX-1,original_end);
}
while(_offset<0);
if(preferred_found)*_sr=*&preferred_sr;
if(preferred_found)*_sr=preferred_sr;
return 0;
}

Expand Down Expand Up @@ -1445,8 +1445,8 @@ static int op_open_seekable2(OggOpusFile *_of){
/*This is a bit too large to put on the stack unconditionally.*/
op_start=(ogg_packet *)_ogg_malloc(sizeof(*op_start)*start_op_count);
if(op_start==NULL)return OP_EFAULT;
*&oy_start=_of->oy;
*&os_start=_of->os;
oy_start=_of->oy;
os_start=_of->os;
prev_page_offset=_of->prev_page_offset;
start_offset=_of->offset;
memcpy(op_start,_of->op,sizeof(*op_start)*start_op_count);
Expand All @@ -1457,8 +1457,8 @@ static int op_open_seekable2(OggOpusFile *_of){
/*Restore the old stream state.*/
ogg_stream_clear(&_of->os);
ogg_sync_clear(&_of->oy);
*&_of->oy=*&oy_start;
*&_of->os=*&os_start;
_of->oy=oy_start;
_of->os=os_start;
_of->offset=start_offset;
_of->op_count=start_op_count;
memcpy(_of->op,op_start,sizeof(*_of->op)*start_op_count);
Expand Down Expand Up @@ -1521,7 +1521,7 @@ static int op_open1(OggOpusFile *_of,
if(OP_UNLIKELY(_initial_bytes>(size_t)LONG_MAX))return OP_EFAULT;
_of->end=-1;
_of->stream=_stream;
*&_of->callbacks=*_cb;
_of->callbacks=*_cb;
/*At a minimum, we need to be able to read data.*/
if(OP_UNLIKELY(_of->callbacks.read==NULL))return OP_EREAD;
/*Initialize the framing state.*/
Expand Down Expand Up @@ -1887,7 +1887,7 @@ static int op_fetch_and_process_page(OggOpusFile *_of,
OP_ASSERT(_of->ready_state>=OP_OPENED);
/*If we were given a page to use, use it.*/
if(_og!=NULL){
*&og=*_og;
og=*_og;
_og=NULL;
}
/*Keep reading until we get a page with the correct serialno.*/
Expand Down